Hi dear Michael,
Tnx a lot for zeep library.
I'm working on a project and use a web service that I attach it's wsdl file to this issue :
when I use "SendNumberGroup" method of service, then this error raised :
TypeError at /
'NoneType' object is not iterable
File of error described :
TypeError.htm.zip
the target web service developed with C# .Net and error raised for ArrayOfLong value.
my code in simple state :
from zeep import Client
import array
WSDLPath = 'http://sms.mysite.com/SMSWS/SOAPWebService.asmx?wsdl'
client = Client(WSDLPath)
def SendSMSToGroup():
groups = array.array('i', [38477411, 38477412]).tolist()
client.service.SendNumberGroup(3364, 'myuser', 'mypassword', '', groups,
'Hi dude!\rFrom site SMS Panel!!', '3000267010', False, True)
return
and this one does not work too:
groups = [38477411, 38477412]
what's wrong ?
Hi,
I had a similar problem so I will try to help you, even if I am not sure I can be helpful
I think that groups which is an ArrayOfLong is a complex type on your server, thus you cannot simply send a python object.
In zeep there are two options:
you can get the object definition using
array_type = client.get_type('tns:ArrayOfLong')
and then create the object
groups = array_type(long=array.array('i', [38477411, 38477412]).tolist())
client.service.SendNumberGroup(3364, 'myuser', 'mypassword', '',groups,
'Hi dude!\rFrom site SMS Panel!!', '3000267010', False, True)
or if you want to send the object direct you can send a dictionary thus
client.service.SendNumberGroup(3364, 'myuser', 'mypassword', '',{'long': groups},
'Hi dude!\rFrom site SMS Panel!!', '3000267010', False, True)
In my examples I used 'long' as the attribute of ArrayOfLong as I found it checking on the Internet. Anyway if you use the first approach loading the type and then creating the object, you will get an error that lists the correct available attributes when you try to create an object using unexisting ones.
Thanks dear @Colleoni
second solution works for me and service method run correctly.
with best regards to @mvantellingen
Most helpful comment
Hi,
I had a similar problem so I will try to help you, even if I am not sure I can be helpful
I think that groups which is an ArrayOfLong is a complex type on your server, thus you cannot simply send a python object.
In zeep there are two options:
you can get the object definition using
array_type = client.get_type('tns:ArrayOfLong')and then create the object
or if you want to send the object direct you can send a dictionary thus
In my examples I used 'long' as the attribute of ArrayOfLong as I found it checking on the Internet. Anyway if you use the first approach loading the type and then creating the object, you will get an error that lists the correct available attributes when you try to create an object using unexisting ones.