网上看到的一个suds 给webservice接口函数传入参数的列子

http://www.douban.com/group/topic/30890518/
各位豆友,最近用python开发一个小项目,调用服务商提供的webservice接口(http://202.105.212.146:8080/jboss-net/services/SendSMS?wsdl),接口函数sendSMSV2有一个参数callee,type="impl:ArrayOf_xsd_string" ,使用suds调用这个函数时,如何输入callee这个参数? 
本人对soap和suds不熟,诚心向各位求教。
import suds
url='http://202.105.212.146:8080/jboss-net/services/SendSMS?wsdl'
client=suds.client.Client(url)
print(client)

======================print(client)===========================================
Suds ( https://fedorahosted.org/suds/ )  version: 0.4.1 jurko 3


Service ( SendSMSService ) tns="http://202.105.212.146:8080/jboss-net/services/SendSMS"
   Prefixes (2)
      ns0 = "http://202.105.212.146:8080/jboss-net/services/SendSMS"
      ns1 = "http://schemas.xmlsoap.org/soap/encoding/"
   Ports (1):
      (SendSMS)
         Methods (4):
            qryOffLineSMS(xs:string ucNumber, xs:string ucPinNum, xs:string rand, xs:string connID)
            qrySendSMSStat(xs:string ucNumber, xs:int smsFlag, xs:string ucPinNum, xs:string rand, xs:string connID)
            sendSMS(xs:string uc, xs:string pw, xs:string rand, ArrayOf_xsd_string callee, xs:string isreturn, xs:string cont, xs:int msgid, xs:string connID)
            sendSMSV2(xs:string uc, xs:string pw, xs:string rand, ArrayOf_xsd_string callee, xs:string isreturn, xs:string cont, xs:int msgID, xs:string connID, xs:int charset)
         Types (49):
            ns1:Array
            ArrayOf_xsd_string
            ns1:ENTITIES
            ns1:ENTITY
=========================================
答案:
刚才测试成功, 
client = Client(wsdl_url) 
array = client.factory.create('ns1:Array') 
array.item = ['mobile1','mobile2'] 

将array带入参数即可。

你可能感兴趣的:(String,python,webservice,mobile,SOAP,methods)