On Sun, Apr 26, 2009 at 7:54 AM, Steve Chernyak mrrothstein@gmail.com wrote:
I'm running into problems using sharepoint soap API. This is my first time working with python, so I could be totally wrong. However, it seems that there is a bug in how SUDS handles attributes when the schema is defined by "any".
Here is the relative part of the schema: <s:element name="GetListItemsResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="GetListItemsResult"> <s:complexType mixed="true"> <s:sequence> <s:any /> </s:sequence> </s:complexType> </s:element> </s:sequence> </s:complexType> </s:element>
And here is the relative part of the response:
<GetListResult> <List DocTemplateUrl="" EmailInsertsFolder="" > ....
This fails with: DEBUG:suds.resolver:searching parent (<Any:0x12fed28 />) for (@EmailInsertsFolder) Traceback (most recent call last): File "C:\development\IDEs\eclipse\workspace\cgi\sharepoint2jira\src\synch\sharepoint2jira.py", line 13, in <module> list = client.service.GetList(listName='Issues List') File "C:\development\python\python-suds-0.3.5\suds\client.py", line 240, in __call__ return target.call(*args, **kwargs) File "C:\development\python\python-suds-0.3.5\suds\client.py", line 379, in call return method(*args, **kwargs) File "C:\development\python\python-suds-0.3.5\suds\client.py", line 240, in __call__ return target.call(*args, **kwargs) File "C:\development\python\python-suds-0.3.5\suds\client.py", line 422, in call return client.invoke(args, kwargs) File "C:\development\python\python-suds-0.3.5\suds\client.py", line 480, in invoke result = self.send(msg) File "C:\development\python\python-suds-0.3.5\suds\client.py", line 505, in send result = self.succeeded(binding, reply.message) File "C:\development\python\python-suds-0.3.5\suds\client.py", line 537, in succeeded r, p = binding.get_reply(self.method, reply) File "C:\development\python\python-suds-0.3.5\suds\bindings\binding.py", line 149, in get_reply result = unmarshaller.process(nodes[0], resolved) File "C:\development\python\python-suds-0.3.5\suds\bindings\unmarshaller.py", line 302, in process return UMBase.process(self, content) File "C:\development\python\python-suds-0.3.5\suds\bindings\unmarshaller.py", line 87, in process data, result = self.append(content) File "C:\development\python\python-suds-0.3.5\suds\bindings\unmarshaller.py", line 103, in append self.append_children(content) File "C:\development\python\python-suds-0.3.5\suds\bindings\unmarshaller.py", line 180, in append_children cdata, cval = self.append(cont) File "C:\development\python\python-suds-0.3.5\suds\bindings\unmarshaller.py", line 102, in append self.append_attributes(content) File "C:\development\python\python-suds-0.3.5\suds\bindings\unmarshaller.py", line 156, in append_attributes self.append_attribute(name, value, content) File "C:\development\python\python-suds-0.3.5\suds\bindings\unmarshaller.py", line 389, in append_attribute type = self.resolver.findattr(name) File "C:\development\python\python-suds-0.3.5\suds\resolver.py", line 364, in findattr result, ancestry = self.getchild(name, parent) ValueError: need more than 0 values to unpack
I was able to trace it down to the Any class in sxbasics.py returning self from get_attribute (which fails to unpack into 2 variables?) Changing the return to (None, []) fixes the problem, but I'm not sure if that's the correct fix or I'm just doing something wrong.
Looks like it might be fixed in trunk:
https://fedorahosted.org/suds/browser/trunk/suds/xsd/sxbasic.py
If you might end up using some WS-Security features you might want to try my branch which has some WS-Security additions on top of trunk:
http://bitbucket.org/schmichael/suds-timestamp/
Hope that helps!
Michael Schurter