Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I consume a WSDL (SOAP) web service in Python?

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.

like image 226
davidmytton Avatar asked Sep 26 '22 05:09

davidmytton


2 Answers

I would recommend that you have a look at SUDS

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

like image 50
Yusufk Avatar answered Oct 07 '22 18:10

Yusufk


There is a relatively new library which is very promising and albeit still poorly documented, seems very clean and pythonic: python zeep.

See also this answer for an example.

like image 32
lorenzog Avatar answered Oct 07 '22 16:10

lorenzog