将int的python数组转换为SOAP ArrayFint
我使用so通过SOAP调用函数,SOAP接受'ArrayofInt'类型的参数 传递“普通”整数数组无效。。。解决方法是使用for循环遍历数组的元素并逐个发送元素,但这不是我编写过的最干净的代码:) 有什么建议吗?这会帮你解决的。 使用Zeep的client.get_type函数创建一个空的Zeep ArrayFint对象,然后在其中循环数组将int的python数组转换为SOAP ArrayFint,python,web-services,soap,xsd,zeep,Python,Web Services,Soap,Xsd,Zeep,我使用so通过SOAP调用函数,SOAP接受'ArrayofInt'类型的参数 传递“普通”整数数组无效。。。解决方法是使用for循环遍历数组的元素并逐个发送元素,但这不是我编写过的最干净的代码:) 有什么建议吗?这会帮你解决的。 使用Zeep的client.get_type函数创建一个空的Zeep ArrayFint对象,然后在其中循环数组 client = Client(soap_url) test_list = [1,2,3,4] emptyArrayPlaceholder = clie
client = Client(soap_url)
test_list = [1,2,3,4]
emptyArrayPlaceholder = client.get_type('ns0:ArrayOfInt')
options = emptyArrayPlaceholder()
for el in test_list:
options['int'].append(el)
这会帮你解决问题的。
使用Zeep的client.get_type函数创建一个空的Zeep ArrayFint对象,然后在其中循环数组
client = Client(soap_url)
test_list = [1,2,3,4]
emptyArrayPlaceholder = client.get_type('ns0:ArrayOfInt')
options = emptyArrayPlaceholder()
for el in test_list:
options['int'].append(el)
如果无法从wsdl检索对象,请尝试以下操作:
client = Client(soap_url)
test_list = [1,2,3,4]
client.service.ServiceName({"foo": {"int": test_list}})
如果无法从wsdl检索对象,请尝试以下操作:
client = Client(soap_url)
test_list = [1,2,3,4]
client.service.ServiceName({"foo": {"int": test_list}})
如果SOAP服务中的方法接受整数数组作为参数,则可以尝试以下方法:
clientInt = Client(wsdl)
list_int=[1,2,3]
dict_int = {"ArrayOfInteger":{"integer":list_int}}
clientInt.service.getMultipleInt(**dict_int)
当您将**dict_int作为参数传递时,python3将解包字典并将字典中的关键字作为函数参数传递。如果您在SOAP服务中的方法接受整数数组作为参数,则可以尝试以下方法:
clientInt = Client(wsdl)
list_int=[1,2,3]
dict_int = {"ArrayOfInteger":{"integer":list_int}}
clientInt.service.getMultipleInt(**dict_int)
当您将**dict_int作为参数传递时,python3将解包字典并将字典中的关键字作为函数参数传递