python3用suds调用webService, 当参数是对象数组时

from suds.client import Client
url = 'http://127.0.0.1:3945/service/BMS_ExecuteSQLProcedureService.wsdl'
client = Client(url)
print(client)

'''
这里是打印的结果
Suds ( https://github.com/cackharot/suds-py3 )  version: 1.3.4.0 IN  build: 20191029

Service ( BMS_ExecuteSQLProcedureServiceService ) tns="http://product.mittop.com/bms/ws/schema"
   Prefixes (1)
      ns0 = "http://product.mittop.com/bms/ws/schema"
   Ports (1):
      (BMS_ExecuteSQLProcedureServiceSoap11)
         Methods (2):
            executeSQLProcedure(xs:string msgId, xs:string sendTime, xs:string system, xs:string domainCode, items items, )
            executeSQLProcedureJSON(xs:string msgId, xs:string sendTime, xs:string system, xs:string domainCode, items items, )
         Types (2):
            RequestItem
            ResponseItem
'''

#这里必须是ns0, 而不是wsdl中的tns:RequestItem
requestItem = client.factory.create('ns0:RequestItem')
requestItem.procedureName = 'PACKAGE_INTERFACE_EBS.PRO_SYNC_PROJECT_ARRIVE'
requestItem.procedureParameters = ''
requestItem.executePassword = 'myPassword'

print(requestItem)
'''
打印结果
(RequestItem){
   procedureName = "PACKAGE_INTERFACE_EBS.PRO_SYNC_PROJECT_ARRIVE"
   procedureParameters = ""
   executePassword = "myPassword"
 }
'''

'''
这里要求加入item名称, 下面是wsdl中的定义, 我之前因为没有加item名称, 调试不过去,还以为suds有问题呢。













'''

requestItems =[{
    'item': requestItem
}]

print(requestItems)
'''
打印结果
[{'item': }]
'''

result = client.service.executeSQLProcedureJSON('msgId', '2019-11-03 13:45:00','wxc', 'Default', requestItems)
print(result)
'''
打印结果 正确
{"msgId":"msgId","sendTime":"2019-11-03 13:45:00","flag":"S","message":"Success","handleTime":"2019-11-04 14:31:09","items":[{"procedureName":"PACKAGE_INTERFACE_EBS.PRO_SYNC_PROJECT_ARRIVE","procedureParameters":"","errorNumber":0,"errorMessage":"OK"}]}

问题:result = client.service.executeSQLProcedure('msgId', '2019-11-03 13:45:00','wxc', 'Default', requestItems)就通不过,为什么?
'''

你可能感兴趣的:(python3用suds调用webService, 当参数是对象数组时)