Tuesday, November 28, 2017

Re: Passing parameters to SOAP Zeep client

Thanks James for your precious suggestions. 
Unfortunatly Zeep haven't a support forum, so I tryed on the django-users group.
According your suggestions I try with:


var=({'utenteApplicativo': 'YZSMOPMO'}, {'carrelloDto':{'idCarrelloSorgente': '99999999994'}, 'itemCarrelloDtoList':{'causale': 'prova', 'codiceEnte':'CCIAA_MI', \
'importo':2, 'importoImposta':1, 'importoTotale':3, 'importoUnitario':2, 'quantitaItem':1, 'tipoContabilizzazione':'TA'}})
print('variabile: ', var)
print(type(var))

call=client.service.creaCarrello(var)
in this manner I have a list variable: var. But I receive the error:

Missing element utenteApplicativo (creaCarrello.GestioneCarrelliRequest)

It is not the correct manner.
Any help are welcome.
Thanks.

Il giorno martedì 28 novembre 2017 10:49:10 UTC+1, James Schneider ha scritto:


On Nov 28, 2017 1:20 AM, "giuseppe ricci" <peppep...@gmail.com> wrote:
I'm using Zeep library to query a SOAP webservice wrote in Java.
My piece of the wsdl file is:

This is the Django users mailing list, so we probably won't be of much help. You should investigate the support forums for Zeep. 

I piloted a small program using it a year or so ago, but I don't have much experience with it as the project went south for other reasons. Neat library to handle the awfulness that is SOAP.


ValidationError at /soapclient/
Missing element utenteApplicativo (creaCarrello.GestioneCarrelliRequest)
The problem it seems the manner of passing the parameters. With this other manner:

call=client.service.creaCarrello(XXXX', {11223344, {'causale':'prova', 'codiceEnte':'CCIAA_MI', \
'importo':2, 'importoImposta':1, 'importoTotale':3, 'importoUnitario':2, 'quantitaItem':1, 'tipoContabilizzazione':'TA'}, },)

I receive the error: unhashable type: 'dict'.

Can you help me to understand what is the correct manner to pass these parameters to the zeep client? There are a set of parameters inside another set..Is it supported by zeep?
Thanks.

If memory serves, yes, you can nest parameters and values in a request, pretty sure I've done it. However, your code is not using nested dictionaries. It appears you are missing a dict key (and possibly a ' unless that's from sanitizing the code). The way your code stands, the second parameter is a Python set, and the second element of that set is a dict, which can't be hashed. Hashing is required for sets, but not for dicts. 

Most likely you meant for the set to be a dict, but forgot to include the keys. I think Zeep exclusively used dicts and lists in their method calls to ease XML serialization, unless something has changed recently.

But again, you'll find better help on the Zeep forums.

-James

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5a212e2d-13cd-4df3-b72c-7a32bd7b9c31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment