本文整理汇总了Python中SOAPpy.SOAPProxy._callWithBody方法的典型用法代码示例。如果您正苦于以下问题:Python SOAPProxy._callWithBody方法的具体用法?Python SOAPProxy._callWithBody怎么用?Python SOAPProxy._callWithBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SOAPpy.SOAPProxy
的用法示例。
在下文中一共展示了SOAPProxy._callWithBody方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from SOAPpy import SOAPProxy [as 别名]
# 或者: from SOAPpy.SOAPProxy import _callWithBody [as 别名]
# Set namespaces
soapBody._setAttr("xmlns:ns2", "http://4psa.com/UserMessages.xsd/" + version)
# Set endpoint
endpoint = "https://" + str(sys.argv[1]) + "/soap2/user_agent.php"
# Set soapaction
soapaction = "http://4psa.com/User/" + version + ":getUsersIn"
# Set service connection
server = SOAPProxy(endpoint, noroot = 1, soapaction = soapaction, header = soapHeader)
#run our soap request
try:
users = server._callWithBody(soapBody)
except SOAPpy.Types.faultType, error:
# Catch exception, for situations when the users could not be fetched
print "Error " + error[0] + ": " + error[1]
sys.exit(1)
# Get the id of a random user
userID = None
if len(users) != 0:
randUser = users[random.randint(0, len(users) - 1)]
if hasattr(randUser, 'ID'):
userID = randUser.ID
if hasattr(randUser, 'name'):
print "Using parent user " + randUser.name + "."
else:
print "Using parent user with id " + userID + "."
示例2: str
# 需要导入模块: from SOAPpy import SOAPProxy [as 别名]
# 或者: from SOAPpy.SOAPProxy import _callWithBody [as 别名]
# Set namespaces
soapBody._setAttr("xmlns:ns2", "http://4psa.com/OrganizationMessages.xsd/" + version)
# Set endpoint
endpoint = "https://" + str(sys.argv[1]) + "/soap2/organization_agent.php"
# Set soapaction
soapaction = "http://4psa.com/Organization/" + version +":getOrganizationsIn"
# Set service connection
server = SOAPProxy(endpoint, noroot = 1, soapaction = soapaction, header = soapHeader)
#run our soap request
try:
organizations = server._callWithBody(soapBody)
except SOAPpy.Types.faultType, error:
# Catch exception, for situations when the organizations could not be fetched
print "Error " + error[0] + ": " + error[1]
sys.exit(1)
# Get the id of a random organization
organizationID = None
if len(organizations) != 0:
randOrganization = organizations[random.randint(0, len(organizations) - 1)]
if hasattr(randOrganization, 'ID'):
organizationID = randOrganization.ID
if hasattr(randOrganization, 'name'):
print "Using parent organization " + randOrganization.name + "."
else:
print "Using parent organization with id " + organizationID + "."
示例3: str
# 需要导入模块: from SOAPpy import SOAPProxy [as 别名]
# 或者: from SOAPpy.SOAPProxy import _callWithBody [as 别名]
# Set namespaces
soapBody._setAttr("xmlns:ns2", "http://4psa.com/BillingMessages.xsd/" + version)
# Set endpoint
endpoint = "https://" + str(sys.argv[1]) + "/soap2/billing_agent.php"
# Set soapaction
soapaction = "http://4psa.com/Billing/" + version + ":getChargingPlansIn"
# Set service connection
server = SOAPProxy(endpoint, noroot = 1, soapaction = soapaction, header = soapHeader)
#run our soap request
try:
chargingPlans = server._callWithBody(soapBody)
except SOAPpy.Types.faultType, error:
# Catch exception, for situations when the charging plans could not be fetched
print "Error " + error[0] + ": " + error[1]
sys.exit(1)
# Get the id of a random charging plan
chargingPlanID = None
if len(chargingPlans) != 0:
randChargingPlan = chargingPlans[random.randint(0, len(chargingPlans) - 1)]
if hasattr(randChargingPlan, 'ID'):
chargingPlanID = randChargingPlan.ID
if hasattr(randChargingPlan, 'name'):
print "Using charging plan " + randChargingPlan.name + "."
else:
print "Using charging plan with id " + chargingPlanID + "."
示例4: str
# 需要导入模块: from SOAPpy import SOAPProxy [as 别名]
# 或者: from SOAPpy.SOAPProxy import _callWithBody [as 别名]
# Set namespaces
soapBody._setAttr("xmlns:ns2", "http://4psa.com/ExtensionMessages.xsd/" + version)
# Set endpoint
endpoint = "https://" + str(sys.argv[1]) + "/soap2/extension_agent.php"
# Set soapaction
soapaction = "http://4psa.com/User/" + version + ":getExtensionsIn"
# Set service connection
server = SOAPProxy(endpoint, noroot = 1, soapaction = soapaction, header = soapHeader)
#run our soap request
try:
extensions = server._callWithBody(soapBody)
except SOAPpy.Types.faultType, error:
# Catch exception, for situations when the extensions could not be fetched
print "Error " + error[0] + ": " + error[1]
sys.exit(1)
# Get the identifier of a random extension
extensionIdentifier = None
if len(extensions) != 0:
randExtension = extensions[random.randint(0, len(extensions) - 1)]
if hasattr(randExtension, 'identifier'):
extensionIdentifier = randExtension.identifier
if hasattr(randExtension, 'name'):
print "Fetching call costs for extension " + randExtension.name + "."
else:
print "Fetching call costs for extension with identifier " + extensionIdentifier + "."