Ticket #342 (assigned enhancement)

Opened 4 years ago

Last modified 3 years ago

Add support for <choice/> for parameters to methods

Reported by: bennetb01 Owned by: jortel
Priority: major Milestone: 0.4
Component: wsdl/schema Version: 0.4.1
Keywords: choice Cc: bennetb@…
Blocked By: Blocking:

Description

I have a WSDL file that has many parameters wrapped in <choice/> tags and none of them are showing any parameters to be passed.

The attached log for 'suds.bindings.document' and wsdl shows thousands of methods that are built this way and none of them are usable without at least one parameter.

Attachments

soap.log (173.9 KB) - added by bennetb01 4 years ago.
Log file of 'suds.bindings.document'
AXLAPI.wsdl (212.7 KB) - added by bennetb01 4 years ago.
Main WSDL file trying to consume
AXLSoap.xsd-part1 (357.2 KB) - added by bennetb01 4 years ago.
Imported XSD file (where <choice/> lives) (Part 1.. combine with part 2 to recreate file)
AXLSoap.xsd-part2 (383.3 KB) - added by bennetb01 4 years ago.
Imported XSD file (where <choice/> lives) (Part 2.. combine with part 1 to recreate file)
0.3.9-choice.patch (1.2 KB) - added by bennetb01 3 years ago.
Patch from thetechchef.com website
suds-0.4-choice-parameters.patch (1.1 KB) - added by michaelgruenewald 3 years ago.
<choice> parameters for suds 0.4
suds-0.4.1-choice-attribute.patch (842 bytes) - added by conver 3 years ago.
Added Attribute import and append
suds-r706-choice-attribute.patch (1.1 KB) - added by bennetb01 3 years ago.
Updated patch from michaelgruenewald against trunk r706

Change History

Changed 4 years ago by bennetb01

Log file of 'suds.bindings.document'

Changed 4 years ago by bennetb01

Main WSDL file trying to consume

Changed 4 years ago by bennetb01

Imported XSD file (where <choice/> lives) (Part 1.. combine with part 2 to recreate file)

Changed 4 years ago by bennetb01

Imported XSD file (where <choice/> lives) (Part 2.. combine with part 1 to recreate file)

comment:1 Changed 4 years ago by bennetb01

It looks like this has been intentionally turned off in changeset r554. It is unclear from the commit why this was disabled.

What was the idea of supporting this in the future?

comment:2 Changed 3 years ago by bennetb01

marcrosoft from irc pointed out someone who has created a modified source tree here: http://www.thetechchef.com/2010/08/10/python-suds-0-3-9-modified-to-allow-choice/.

I will work on extracting out a patch.

Changed 3 years ago by bennetb01

Patch from thetechchef.com website

comment:3 follow-up: ↓ 6 Changed 3 years ago by bennetb01

I've attached the patch from the website listed above. It just comments out the code in r554. This does work against the 4.0 branch as well as trunk (r704 at the time of this writing).

So obviously this is not a real fix to the issue but does bring me back around to why r544 was committed and it's purpose? I would like to work on a true patch to the issue at it seems that I am not the only one with <choice/> in my WSDL files, but better understanding of r554 would be required.

comment:4 Changed 3 years ago by jortel

  • Status changed from new to assigned
  • Version changed from 0.3.9 to 0.4.1

comment:5 Changed 3 years ago by bennetb01

This seems to be a duplicate of #332 (which has a patch) or at least related.

comment:6 in reply to: ↑ 3 Changed 3 years ago by michaelgruenewald

Replying to bennetb01:

So obviously this is not a real fix to the issue but does bring me back around to why r544 was committed and it's purpose? I would like to work on a true patch to the issue at it seems that I am not the only one with <choice/> in my WSDL files, but better understanding of r554 would be required.

This patch does produce problems if you have multiple optional elements in the choice (common in EWS). If you apply the patch suds will always create all the optional elements, not only those you passed. That in turn results in the generated XML not being schema-valid.

Changed 3 years ago by michaelgruenewald

<choice> parameters for suds 0.4

comment:7 Changed 3 years ago by michaelgruenewald

I tried another approach and let the code remember whether the parameter was a by-choice parameter. In that case, it will always use the parameter. Works for me in combination with EWS.

comment:8 Changed 3 years ago by conver

I couldn't get this patch to work initially. I had to includes lines 11-13 of the patch as well as add a from suds.sax.attribute import Attribute import. Finally got SUDS working with EWS though...

Changed 3 years ago by conver

Added Attribute import and append

Changed 3 years ago by bennetb01

Updated patch from michaelgruenewald against trunk r706

Note: See TracTickets for help on using tickets.