Hi List, I'm quite new with python and SOAP / suds.
I have a local wsdl file which works fine with all functions giving back standard return values. But when I try to get back a complex type it fails with :
DEBUG:suds.client:headers = {'SOAPAction': u'""', 'Content-Type': 'text/xml; charset=utf-8'} DEBUG:suds.client:http succeeded: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:vserver2.como.com"> SOAP-ENV:Header</SOAP-ENV:Header> <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/%22%3E ns1:getcpuinfoResponse <result xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cpuinfo[4]"> <item> <processor>0</processor> <vendor>GenuineIntel</vendor> <model>Intel(R) Xeon(R) CPU E5504 @ 2.00GHz</model> <frequency>1999.768</frequency> <cache-size>4096</cache-size> <bogomips>4008.600</bogomips> </item> <item> <processor>1</processor> <vendor>GenuineIntel</vendor> <model>Intel(R) Xeon(R) CPU E5504 @ 2.00GHz</model> <frequency>1999.768</frequency> <cache-size>4096</cache-size> <bogomips>4000.430</bogomips> </item> .... </result> </ns1:getcpuinfoResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope> Traceback (most recent call last): File "/path/to/source/src/test.py", line 24, in <module> result = client.service.getcpuinfo() File "build/bdist.macosx-10.6-universal/egg/suds/client.py", line 542, in __call__ File "build/bdist.macosx-10.6-universal/egg/suds/client.py", line 602, in invoke File "build/bdist.macosx-10.6-universal/egg/suds/client.py", line 643, in send File "build/bdist.macosx-10.6-universal/egg/suds/client.py", line 678, in succeeded File "build/bdist.macosx-10.6-universal/egg/suds/bindings/binding.py", line 165, in get_reply File "build/bdist.macosx-10.6-universal/egg/suds/umx/typed.py", line 66, in process File "build/bdist.macosx-10.6-universal/egg/suds/umx/core.py", line 48, in process File "build/bdist.macosx-10.6-universal/egg/suds/umx/core.py", line 63, in append File "build/bdist.macosx-10.6-universal/egg/suds/umx/core.py", line 140, in append_children File "build/bdist.macosx-10.6-universal/egg/suds/umx/core.py", line 61, in append File "build/bdist.macosx-10.6-universal/egg/suds/umx/encoded.py", line 47, in start File "build/bdist.macosx-10.6-universal/egg/suds/umx/typed.py", line 77, in start File "build/bdist.macosx-10.6-universal/egg/suds/resolver.py", line 337, in find File "build/bdist.macosx-10.6-universal/egg/suds/resolver.py", line 384, in known File "build/bdist.macosx-10.6-universal/egg/suds/xsd/query.py", line 46, in __init__ Exception: (cpuinfo, None, ), must be qref
here is part of my code :
from suds.client import Client from suds.transport.http import HttpAuthenticated import logging
logging.basicConfig(level=logging.INFO) logging.getLogger('suds.client').setLevel(logging.DEBUG)
t = HttpAuthenticated(username='test', password='test')
wsdl = "file:///path/to/wsdl/file/src/videoserver2.wsdl" server = "http://IP.OF.SER.VER:8080/VServer2.cgi" client = Client(wsdl, transport=t) client.set_options(location=server)
print client.service.getcpuinfo()
here is an extract of the wsdl file:
<complexType name="cpuinfo"> <sequence> <element name="processor" type="xsd:int" minOccurs="1" maxOccurs="1"/> <element name="vendor" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/> <element name="model" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/> <element name="frequency" type="xsd:double" minOccurs="1" maxOccurs="1"/> <element name="cache-size" type="xsd:int" minOccurs="1" maxOccurs="1"/> <element name="bogomips" type="xsd:double" minOccurs="1" maxOccurs="1"/> </sequence> </complexType>
<complexType name="ArrayOfcpuinfo"> <complexContent> <restriction base="SOAP-ENC:Array"> <sequence> <element name="item" type="ns1:cpuinfo" minOccurs="0" maxOccurs="unbounded"/> </sequence> <attribute ref="SOAP-ENC:arrayType" WSDL:arrayType="ns1:cpuinfo[]"/> </restriction> </complexContent> </complexType>
<message name="getcpuinfoRequest"> </message>
<message name="getcpuinfoResponse"> <part name="result" type="ns1:ArrayOfcpuinfo"/> </message>
<operation name="getcpuinfo"> <documentation>Service definition of function ns1__getcpuinfo</documentation> <input message="tns:getcpuinfoRequest"/> <output message="tns:getcpuinfoResponse"/> </operation>
any hint would be apreciated!
kind regards
Lorenz Martens