pythonsuds

Suds Type not Found


I am trying to execute a soap service with suds. The signature from server for the parameter looks like this (taken from print(client))

xs:anyType orderBy

My suds client throws the following exception

suds.TypeNotFound: Type not found: 'orderBy'

In my code i pass the following array as argument

['DESC']

In PHP it works like this

$client->serviceFunctionName([...], array( 'eventdate' => 'DESC' ))

In the original WSDL-XML from Server the Parameter looks like this

<wsdl:part name="orderBy" type="xs:anyType"/>

How can i correctly accomplish this in python suds?

UPDATE

Tried the following, which gets rejected by the server

dict(eventdate='DESC')

Error message from Server

suds.WebFault: Server raised fault: 'Invalid parameter type: param=sort expected=Array got=object'

Regards


Solution

  • It is usually not worth fighting for. Most old web apis delivers some PHP code that just works. If you have it use it to generate template that later on you may use with non SOAP requests lib that you are familiar with:

    <?php 
      // Setting up SOAP request here like in api documentation
    
      echo "REQUEST BODY:\n" . $client->__getLastRequest() . "\n";
      echo "REQUEST HEADERS:\n" . $client->__getLastRequestHeaders() . "\n";
    

    Headers will usually contain content type, basic authorisation token, and endpoint for making requests. Body can be used to create template that may be parameterise and used to request with python or any other stack.