how to generate request to method with "choice" arguments?
part of wsdl at http://127.0.0.1/service?wsdl:
<xs:complexType name="ByA">
<xs:sequence>
...
</xs:sequence>
</xs:complexType>
<xs:complexType name="ByB">
<xs:sequence>
...
</xs:sequence>
</xs:complexType>
<xs:complexType name="GetMethodRequest">
<xs:choice>
<xs:element name="byA" type="s0:ByA" />
<xs:element name="byB" type="s0:ByB" />
</xs:choice>
</xs:complexType>
when I do
from suds.client import Client
client = Client("http://127.0.0.1/service?wsdl")
print client
I see
GetMethod()
without any arguments.
how I can call GetMethod with byA or with byB?
It's a known bug in suds
https://fedorahosted.org/suds/ticket/342
I fixed it so:
class MyPlugin(DocumentPlugin):
def setChoice(self, context):
if not context.children:
return
for i in context.children:
if i.name == "choice":
for j in i.children:
i.parent.append(j)
else:
self.setChoice(i)
def parsed(self, context):
self.setChoice(context.document)
plugin = MyPlugin()
client = Client("http://127.0.0.1/service?wsdl", plugins=[plugin])
It's hard to know without seeing the whole wsdl, your link is to your local machine.
The Suds Client class uses the Service Class as an instance variable for interacting with wsdl. Have you tried something like this?
from suds.client import Client
client = Client("http://127.0.0.1/service?wsdl")
client.service.GetMethod("byA")
or
client.service.GetMethod("byB")