How to create arrayType for WSDL in Python (using suds)?

Posted by Uri on Stack Overflow See other posts from Stack Overflow or by Uri
Published on 2009-07-15T11:20:23Z Indexed on 2010/03/31 14:03 UTC
Read the original article Hit count: 128

Filed under:
|
|
|

Environment:

  • Python v2.6.2
  • suds v0.3.7

The WSDL (server) I work with, have the following schema sub-sections (I tried to write it clearly using plain text) -


[ sub-section #1 ]

searchRequest: (searchRequest){
    userIdentification = (userIdentification){
        username = ""
        password = ""
        }
    itineraryArr = (itineraryArray){
        _arrayType = ""
        _offset = ""
        _id = ""
        _href = ""
        _arrayType = ""
        }
   ...
   ...


[ sub-section #2 ]

itinerary: (itinerary){
    departurePoint = (locationPoint){
        locationId = None
        radius = None
        }
    arrivalPoint = (locationPoint){
        locationId = None
        radius = None
        }
   ...
   ...


There is no problem with 'userIdentification' (which is a "simple" type)

But, 'itineraryArr' is an array of 'itinerary', and I don't know how to use python to create XML array.

I tried few combinations, for example

itinerary0 = self.client.factory.create('itinerary')
itineraryArray = self.client.factory.create('itineraryArray')
itineraryArray = [itinerary0]
searchRequest.itineraryArr = itineraryArray

But all my trials resulted with the same server error -

    Server raised fault: 'Cannot use object of type itinerary as array'
    (Fault){
       faultcode = "SOAP-ENV:Server"
       faultstring = "Cannot use object of type itinerary as array"
     }

Appreciate you help.....

Thanks, Uri

© Stack Overflow or respective owner

Related posts about python

Related posts about suds