Hi, I'am writting a simple SOAP client in python (2.4) using SOAPpy lib. I've met with this problem:
when I want to send a list of complex type using some method from WebService(java,WAS), I'v got an exception: ********************** SOAPpy.Types.faultType: <Fault Server.generalException: org.xml.sax.SAXException: WSWS3136E: Error: No deserializer defined for array type {http://www.w3.org/1999/XMLSchema}instance: > I understand that this exception comes from WebService server(WAS,java), and I know the reason of this exception, A SOAP request genereted by SOAPpy contains invalid information about Type of objects (which I've send). Example: ******* ServerSide (I know a list o methods and data types, so I don't read WSDL) ---------------------------------------------------------------------------- server serve method: sendMyElements(MyClass input) where 'MyClass' is a class which contains two fields: 'sessionId' --------- just STRING 'myElements'--------- an array of 'MyElement' where 'MyElement' is class which contains some simple string fields (name, desecr) ClientSide -------------------- from SOAPpy import WSDL url = 'http://localhost:9080/RouterTestWeb/services/Test/wsdl/Test.wsdl' serv = WSDL.Proxy(url) print serv.methods.keys() class MyElement: def __init__(self,x,y): self.name=x self.descr=y class MyClass: def __init__(self): self.sessionId="someSessionId-someSessionId-someSessionId" #!!!!!!!!!!!!!!!!!!!!!! LOOK THIS LINE self.myElements =MyElement("a","a"),MyElement("b","b"),MyElement("c","")] print serv.sendMyElements(MyClass()) Look at the line where I create list of elements MyElement, In python type 'list' is able to store object of any type (example: [123,"sddsf",MyElement()]), Maybe this type ('list') gives me to abstract level, cause whey: list=['a',213,MyElement('as',''),MyElement('adsf',''),MyElement('asdsad','')] print type(list) for a in list: print a,type(a) I get ... <type 'list'> -------for list, below for list's elements a <type 'str'> 213 <type 'int'> <__main__.MyElement instance at 0x00D4ABC0> <type 'instance'> <__main__.MyElement instance at 0x00D56C10> <type 'instance'> <__main__.MyElement instance at 0x00D56CD8> <type 'instance'> Important, the type(MyElement("sadas","sad")) returns <type 'instance'> and this information (I think) is used by SOAPpy lib while creating SOAP request, a piece of SOAP request: <saveArrayOfData SOAP-ENC:arrayType="xsd:instance[3]" xsi:type="SOAP-ENC:Array" SOAP-ENC:root="0" id="i2"> <item href="#i4"/> <item href="#i5"/> <item href="#i6"/> </saveArrayOfData> I see here, that I'am sending an array of object 'instance' (SOAP-ENC:arrayType="xsd:instance[3]"), but a want to send an array of MyElements. QUESTIONs ********* 1. What shoud I do send an array of objects only one type (MyElement) ? - create more strict data type than 'list'? - force object - an instance of MyElement class to return proper info about 'type' (type(MyElement('',''))) 2. Maybe, I should use 'wsdl2py' to create valid structures (but 'wsdl2py' sometimes fails while parsing my WSDLs - with error RuntimeError: maximum recursion depth exceeded) 3. Maybe, I should use other library than SOAPpy Thanks for any help, Bartek -- http://mail.python.org/mailman/listinfo/python-list