Python-zeep: When an element has a default value, Zeeps always sends that value as part of the request, event though minOccurs=0

Created on 19 Apr 2017  路  5Comments  路  Source: mvantellingen/python-zeep

Zeep version: Tested on both 1.1 and 1.4.1
WSDL example causing the issue:
https://gist.github.com/aerandir92/3cb06877af1428fb19c1be1fd59b204b

As you can see from the gist there are several elements that can be a part of the request, but only userid is required (minOccurs="1"). All other elements has minOccurs="0".
But, further down you find several elements that have a default value, which of it self isn't a problem, but Zeep always sends these values with the request, making a simple call to an update, much more complicated since we need to make sure that values aren't reset to default by Zeep.

The example I ran into, disocvering this issue, was that enableMobility defaults to False, while the User I was updating, had this set to True already, but since Zeep includes enableMobility=False in all updateUser requests, I now need to make sure that everytime I update a user that does have enableMobility = True, I must send that with the updateUser request.

So in short, Zeep shouldn't automatically fill inn elements in a requests just because it has a default value.

Most helpful comment

Oh shoot, how did I manage to consistently wrote maxOccurs? Anyways, looks like your commit fixes it, great!

All 5 comments

+1

:+1:

Just for the record, I assume you mean minOccurs instead of maxOccurs right?

Oh shoot, how did I manage to consistently wrote maxOccurs? Anyways, looks like your commit fixes it, great!

Thanks !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

allan-simon picture allan-simon  路  4Comments

grguthrie picture grguthrie  路  4Comments

eagle-r picture eagle-r  路  6Comments

vadivelkindhealth picture vadivelkindhealth  路  3Comments

olivierverville picture olivierverville  路  3Comments