python-zeep
python-zeep copied to clipboard
Improve handling of out-of-order values in a sequence
The version of zeep (or if you are running master the commit hash/date)
$ pip show zeep
Name: zeep
Version: 2.2.0
The WSDL you are using
https://gist.github.com/nmaludy/5b44b6b8ce6e0151481250521283d684
An example script
https://gist.github.com/nmaludy/e467d0e0d223d3fe0a9e49a424a08826
XML returned from GetRanges() call
https://gist.github.com/nmaludy/0a22fd84d4c41a7ad58e5cd250633059
Note The <inheritAccess>
tag comes before the <autoAssign>
tag in each range (this is out-of-order with respect to the sequence.
Details
Currently when a server returns values in a <sequence>
that are out-of-order zeep throw an exception: https://gist.github.com/nmaludy/d21a6cc266c844298a0465f5d1da47e4
This is fine because technically this is not valid XML according to the WSDL schema. However, when i pass in strict=False
to the client i get all of the out-of-order elements dumped into a _raw_elements
list on the object. https://gist.github.com/nmaludy/db792168e466e7626ea102569aead04d
Thoughts
When passing strict=False
would it be possible to handle out-of-order values in the sequence and assign them to the correct keys in the dict instead of dumping them to _raw_elements
?
If this is an AXIS soap server then this seems be a duplicate of #493 Can you confirm that? (It seems only the axis servers are doing this completely wrong)
@mvantellingen I don't believe so, this is a Men&Mice IPAM server running on Windows IIS.
Okay. I agree that this should be done better. I'll look into it
FYI; I opened up issue #596 before recognizing that it's a duplicate of this and #493. This is biting me really hard with my AXIS server. Feel free to take a look at my ticket for another example of how sorted children tags are causing breakage.
@mvantellingen If you can point me in the right direction i really wouldn't mind fixing it. I tried going through the code, but it it's my first time looking at it and i got a little lost in all of the lxml
details.
@mvantellingen I'm still interested in helping out here, if you can help point me in the right direction!
You should now be able to use the xsd_ignore_sequence_order
flag in the client's settings to parse responses that contain out of order items in a sequence.
@nmaludy are you sure that your IPAM server is not using Apache Axis library under the hood? I've run into this using some other solution and the xsd_ignore_sequence_order
flag works perfectly for me.
You should now be able to use the
xsd_ignore_sequence_order
flag in the client's settings to parse responses that contain out of order items in a sequence.
This worked perfectly for my issue with the _raw_elements issue.