I have a piece of wsdl as below:
<xs:complexType name="get">
<xs:sequence>
<xs:element name="sessionId" type="xs:string"
minOccurs="0"/>
<xs:element name="query" type="xs:string"
minOccurs="0"/>
<xs:element name="primaryKey" type="xs:anyType"
minOccurs="0"/>
</xs:sequence>
</xs:complexType>
where primaryKey is xs:anyType. The service actually expects to
receive an xs:string or an xs:long but with suds it gets an
ElementNSImpl insteadn when I call from python. I can make calls to
the service with a Java client with no problem.
To get round it I used a plugin:
class GetPlugin(MessagePlugin):
intPat = re.compile("\d+$")
def marshalled(self, context):
body = context.envelope.getChild('Body')
method = body[0]
if method.name == "get":
key = method[2]
if self.intPat.match(key.getText()):
key.set("xsi:type", "xs:long")
else:
key.set("xsi:type", "xs:string")
key.set("xmlns:xs", "http://www.w3.org/2001/XMLSchema")
to guess the correct type. I would rather do it properly in the suds
code but this involves more work understanding the adapters - which
seem to be chosen according to the actual type of the parameter in the
call. Is this a bug in suds or is it following some standard which the
Java (and I belive .net) choose to ignore? The behavior I would expect
is that if the actual parameter is a subtype of the expected parameter
then the actual type information would be included.
Is this a bug which I should report.
Show replies by date