views:

377

answers:

1

I am calling a WSDL web service from Python using SOAPpy. The call I need to make is to the method Auth_login. This has 2 arguments - the first, a string being the API key; the second, a custom type containing username and password. The custom type is called Auth_credentialsData which contains 2 values as stings - one for the username and one for the password. How can I create this custom type using SOAPpy? I tried passing a list and a dictionary, none of which work.

Code so far:

from SOAPpy import WSDL

wsdlUrl = 'https://ws.pingdom.com/soap/PingdomAPI.wsdl'
client = WSDL.Proxy(wsdlUrl)

Tried both:

credentials = ['[email protected]', 'password']
client.Auth_login('key', credentials)

and

credentials = {'username': '[email protected]', 'password': 'passsword'}
client.Auth_login('key', credentials)

both of which give an authentication failed error.

+1  A: 

The better method is to use the ZSI soap module which allows you to take a WDSL file and turn it into classes and methods that you can then use to call it. The online documentation is on their website but the latest documentation is more easily found in the source package. If you install in Debian/Ubuntu (package name python-zsi) the documentation is in /usr/share/doc/python-zsi in a pair of PDFs you can find in there.

Julian Krause