mvantellingen / python-zeep

A Python SOAP client
http://docs.python-zeep.org
Other
1.88k stars 583 forks source link

Array of arrays #581

Open net-storm opened 6 years ago

net-storm commented 6 years ago

Hello,

I`m trying to implement this WSDL http://www.drebedengi.ru/soap/dd.wsdl

In setRecordList method I have to provide array of arrays as documentation says

Here is their example using PHP: https://www.drebedengi.ru/?module=soap&action=soapTest

In my script I`m using helper function from Zeep (Master):

param_value = helpers.create_xml_soap_map( \ { 0 : { 'server_id' : int(entry['id']) , 'place_id' : int(entry['place_id']) , 'budget_object_id': int(entry['budget_object_id']) , 'sum' : int(entry['sum']) , 'operation_date' : entry['operation_date'] , 'comment' : entry['comment'] + ' and something' , 'currency_id' : int(entry['currency_id']) , 'operation_type' : int(entry['operation_type']) } } )

But got big error description saying at the end: ValueError: The String type doesn't accept collections as value

How can I prapare such structure using Zeep?

ma-rp commented 6 years ago

I had a similar error, and solved it by only using the objects defined by the WSDL instead of using dicts.

raheem1316 commented 6 years ago

can u show ur code how u defined objects...

orasik commented 6 years ago

I had this error too, mainly because I was using a function like this:

def my_function(self, user, **kwargs):
       self.user = user
        if 'email' in kwargs:
            self.email = kwargs['email']

and then I was reading the args from POST request, and then assign parsed user to the function:

my_function({args['user']})

So just check on of the arguments you're populating to your function. If you want to debug, just print the service as dict

print service.__dict__

and you'll notice the wrong variable. Hope this will help.