python3调用webservice接口之多参数传递

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

posted on 2017-08-24 11:42  sammy1989  阅读(2811)  评论(0编辑  收藏  举报

导航