SOAPpy, client, execute method that has 'complex' input parameter (with list)?

Bartas bartek.a at
Wed Oct 5 16:15:06 CEST 2005

  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:


 <Fault Server.generalException: org.xml.sax.SAXException:
   WSWS3136E: Error: No deserializer defined for
  array type {}instance: >

  I understand that this exception comes from WebService
  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).


ServerSide (I know a list o methods and data types, so I don't read
server serve method:

  sendMyElements(MyClass input)


'MyClass' is a class which contains two fields:
'sessionId' --------- just STRING
'myElements'--------- an array of 'MyElement'


 'MyElement' is class which contains some simple string fields (name,


  from SOAPpy import WSDL

  url =

  serv = WSDL.Proxy(url)

  print serv.methods.keys()

  class MyElement:
    def __init__(self,x,y):

  class MyClass:
    def __init__(self):

        #!!!!!!!!!!!!!!!!!!!!!! LOOK THIS LINE

  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:

  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
  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"/>

  I see here, that I'am sending an array of object 'instance'
  but a want to send an array of MyElements.

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
     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,

More information about the Python-list mailing list