from suds.client import Client
def func(url, operation, *args):
‘‘‘接口调用‘‘‘
client = Client(url)
result = eval("client.service.%s" % operation)(*args) #eval将字符串转换成变量使用
return result
url = ‘http://10.***.**.***:****/DaiDaiKan/DaiDaiKanService.asmx?wsdl‘ #注意地址后面需要加wsdl
operation = ‘Prereview‘
name = ‘测试01‘
reportId = ‘100‘
reportSn = ‘2016072500003039963690‘
mobile_token = ‘123‘
func(url, operation, str(name), str(reportId), str(reportSn), str(mobile_token))
参考博客地址:
http://blog.csdn.net/qq_15013233/article/details/52369656
http://blog.csdn.net/xocom/article/details/64120902
时间: 2024-10-07 20:07:26