hi,
i ran into a problem with the suds client posting to actions that
contain as a parameter a complexType containing an unbounded literal.
a snippet of the schema looks like this:
(from
http://pastebin.com/f14bdb39c)
<s:element name="SendDocument">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="sessionKey"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="recipientIds" type="tns:ArrayOfInt" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfInt">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded"
name="int"
type="s:int" />
</s:sequence>
</s:complexType>
the python code i was using to post this is (from
http://pastebin.com/f5e256230)
:
def send_discussion_notification(self)
recipient_ids = self._make_wrapper("ArrayOfInt", int=[4, 5])
result = self._client.service.SendDocument(self._session_key,
recipient_ids)
assert result, result
return result
def _make_wrapper(self, wrapper_name, **kwds):
thing = self._client.factory.create(wrapper_name)
for k, v in kwds.iteritems():
setattr(thing, k, v)
return thing
the issue i was having is that it was treating
ArrayOfInt.int as a
primitive and ignoring the unbounded="true" and serializing it as:
<recipientIds><int>[4, 5]</int>
rather than:
<recipientIds><int>4</int><int>5</int></recipientIds>
what fixes this is a patch to suds.xsd.sxbasic.py.
at the beginning of TypedContent.resolve i added a line:
nobuiltin = nobuiltin or self.unbounded()
there might be a more general way to address this issue, but if
someone could please integrate a patch along these lines, it would be
greatly appreciated. btw - i attempted to file an issue in trac for
this but could not figure out where to create a new ticket...
thanks,
ariel