views:

6390

answers:

8

I want to use a WSDL SOAP based web service in Python. I have looked at the Dive Into Python code but the SOAPpy module does not work under Python 2.5.

I have tried using suds which works partly, but breaks with certain types (suds.TypeNotFound: Type not found: 'item').

I have also looked at Client but this does not appear to support WSDL.

And I have looked at ZSI but it looks very complex. Does anyone have any sample code for it?

The WSDL is https://ws.pingdom.com/soap/PingdomAPI.wsdl and works fine with the PHP 5 SOAP client.

+6  A: 

Right now, all the SOAP libraries available for python suck. I recommend avoiding SOAP if possible. The last time we where forced to use a SOAP web service from python, we wrote a wrapper in C# that handled the SOAP on one side and spoke COM out the other.

Matthew Scouten
+2  A: 

I always write my own at the HTTP level. It's really not that hard. I wrote the example here which should be a good starting point for you. Let me know if you have questions.

Greg
"Not that hard" compared to what, smoke signals? Just kidding- a little... that looks like a lot of work to invoke a simple web service!
Dave Swersky
A: 

It's not true SOAPpy does not work with Python 2.5 - it works, although it's very simple and really, really basic. If you want to talk to any more complicated webservice, ZSI is your only friend.

The really useful demo I found is at http://www.ebi.ac.uk/Tools/webservices/tutorials/python - this really helped me to understand how ZSI works.

zgoda
python setup.py install gives errors with the latest release. The latest dev copy might work but that's a pain to do.
DavidM
+2  A: 

I know this is an old thread but it was showing up at the top of google results so I wanted to share a more current discussion on Python and SOAP.

See: http://www.diveintopython.org/soap%5Fweb%5Fservices/index.html

Tony
A: 

If you're rolling your own I'd highly recommend looking at http://effbot.org/zone/element-soap.htm.

sj26
A: 

SOAPpy is now obsolete, AFAIK, replaces by ZSL. It's a moot point, because I can't get either one to work, much less compile, on either Python 2.5 or Python 2.6

ראובן
A: 

of course it sucks, you can't even build/install it http://bytes.com/topic/python/answers/855781-soappy-syntaxerror

Comptrol
A: 

I would recommend that you have a look at SUDS

"Suds is a lightweight SOAP python client for consuming Web Services."

Yusufk