当前位置: 首页>>代码示例>>Python>>正文


Python SOAPProxy._callWithBody方法代码示例

本文整理汇总了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 + "."
开发者ID:4psa,项目名称:systemapi-example-python,代码行数:32,代码来源:DemoAddExtension.py

示例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 + "."
开发者ID:4psa,项目名称:systemapi-example-python,代码行数:32,代码来源:DemoAddUser.py

示例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 + "."
开发者ID:4psa,项目名称:systemapi-example-python,代码行数:32,代码来源:DemoAddServiceProvider.py

示例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 + "."
开发者ID:4psa,项目名称:systemapi-example-python,代码行数:32,代码来源:DemoCallCosts.py


注:本文中的SOAPpy.SOAPProxy._callWithBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。