What SOAP client libraries exist for Python, and where is the documentation for them?

PythonSoapSoap Client

Python Problem Overview


I've never used SOAP before and I'm sort of new to Python. I'm doing this to get myself acquainted with both technologies. I've installed SOAPlib and I've tried to read their Client documentation, but I don't understand it too well. Is there anything else I can look into which is more suited for being a SOAP Client library for Python?

Edit: Just in case it helps, I'm using Python 2.6.

Python Solutions


Solution 1 - Python

Update (2016):

If you only need SOAP client, there is well maintained library called zeep. It supports both Python 2 and 3 :)


Update:

Additionally to what is mentioned above, I will refer to Python WebServices page which is always up-to-date with all actively maintained and recommended modules to SOAP and all other webservice types.


Unfortunately, at the moment, I don't think there is a "best" Python SOAP library. Each of the mainstream ones available has its own pros and cons.

Older libraries:

  • SOAPy: Was the "best," but no longer maintained. Does not work on Python 2.5+

  • ZSI: Very painful to use, and development is slow. Has a module called "SOAPpy", which is different than SOAPy (above).

"Newer" libraries:

  • SUDS: Very Pythonic, and easy to create WSDL-consuming SOAP clients. Creating SOAP servers is a little bit more difficult. (This package does not work with Python3. For Python3 see SUDS-py3)

  • SUDS-py3: The Python3 version of SUDS

  • spyne: Creating servers is easy, creating clients a little bit more challenging. Documentation is somewhat lacking.

  • ladon: Creating servers is much like in soaplib (using a decorator). Ladon exposes more interfaces than SOAP at the same time without extra user code needed.

  • pysimplesoap: very lightweight but useful for both client and server - includes a web2py server integration that ships with web2py.

  • SOAPpy: Distinct from the abandoned SOAPpy that's hosted at the ZSI link above, this version was actually maintained until 2011, now it seems to be abandoned too.

  • soaplib: Easy to use python library for writing and calling soap web services. Webservices written with soaplib are simple, lightweight, work well with other SOAP implementations, and can be deployed as WSGI applications.

  • osa: A fast/slim easy to use SOAP python client library.

Of the above, I've only used SUDS personally, and I liked it a lot.

Solution 2 - Python

I followed the advice of other answers to this question and gave [SUDS][1] a try. After using it "in anger" I must agree: SUDS is very nice! Highly recommended!

I did run into trouble calling HTTPS-based web services from behind a proxy. At the time of this writing, this affects all Python web-service clients that use urllib2, so I'll document the solution here.

The urllib2 module shipping with python 2.6.2 and below will not issue a CONNECT to the proxy for HTTPS-over-HTTP-proxy sessions. This results in a long timeout, or if you are lucky, an error that looks like:

abort: error: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

This was [issue1424152][2] on the Python bug tracker. There are patches attached to the bug report that will fix this in Python 2.x and Python 3.x. The issue is already fixed.

[1]: https://fedorahosted.org/suds "SUDS" [2]: http://bugs.python.org/issue1424152

Solution 3 - Python

I had good experience with SUDS https://fedorahosted.org/suds

Used their TestSuite as documentation.

Solution 4 - Python

SUDS is the way to go, no question about it.

Solution 5 - Python

Just an FYI warning for people looking at SUDS, until this ticket is resolved, SUDS does not support the "choice" tag in WSDL:

https://fedorahosted.org/suds/ticket/342

see: https://stackoverflow.com/questions/5963404/suds-and-choice-tag

Solution 6 - Python

SUDS is easy to use, but is not guaranteed to be re-entrant. If you're keeping the WSDL Client() object around in a threaded app for better performance, there's some risk involved. The solution to this risk, the clone() method, throws the unrecoverable Python 5508 bug, which seems to print but not really throw an exception. Can be confusing, but it works. It is still by far the best Python SOAP client.

Solution 7 - Python

We released a new library: PySimpleSOAP, that provides support for simple and functional client/server. It goals are: ease of use and flexibility (no classes, autogenerated code or xml is required), WSDL introspection and generation, WS-I standard compliance, compatibility (including Java AXIS, .NET and Jboss WS). It is included into Web2Py to enable full-stack solutions (complementing other supported protocols such as XML_RPC, JSON, AMF-RPC, etc.).

If someone is learning SOAP or want to investigate it, I think it is a good choice to start.

Solution 8 - Python

I believe soaplib has deprecated its SOAP client ('sender') in favor of suds. At this point soaplib is focused on being a web framework agnostic SOAP server ('receiver'). Currently soaplib is under active development and is usually discussed in the Python SOAP mailing list:

http://mail.python.org/mailman/listinfo/soap

Solution 9 - Python

In my conclusion we have this:

Soap client side:

use only Suds-jurko (updated 2016) suds is well maintained and updated.

UPDATE 06/2017: suds-jurko library is not updated and apparently abandoned,

I tested zeep library but got limitations around tokens, by now just support UsernameToken, i report a bug to create timestamp token and author update the code to fix it.

Zeep start good and has good documentation , so i recently migrated my code from suds to zeep and works fine.

Soap server side:

We have TGWS, soaplib (pysimplesoap not tested) IMHO use and help soaplib must be the choice.

Best regards,

Solution 10 - Python

As I suggested here I recommend you roll your own. It's actually not that difficult and I suspect that's the reason there aren't better Python SOAP libraries out there.

Solution 11 - Python

suds is pretty good. I tried SOAPpy but didn't get it to work in quite the way I needed whereas suds worked pretty much straight away.

Solution 12 - Python

Could this help: http://users.skynet.be/pascalbotte/rcx-ws-doc/python.htm#SOAPPY

I found it by searching for wsdl and python, with the rational being, that you would need a wsdl description of a SOAP server to do any useful client wrappers....

Solution 13 - Python

We'd used SOAPpy from http://pywebsvcs.sourceforge.net/">Python Web Services, but it seems that ZSI (same source) is replacing it.

Solution 14 - Python

Im using SOAPpy with Python 2.5.3 in a production setting.

I had to manually edit a couple of files in SOAPpy (something about header code being in the wrong place) but other than that it worked and continues to do so very reliably.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondamonView Question on Stackoverflow
Solution 1 - PythonSamat JainView Answer on Stackoverflow
Solution 2 - PythonsstockView Answer on Stackoverflow
Solution 3 - PythonRajeshView Answer on Stackoverflow
Solution 4 - PythonMikeView Answer on Stackoverflow
Solution 5 - PythonDougView Answer on Stackoverflow
Solution 6 - Pythonuser281429View Answer on Stackoverflow
Solution 7 - PythonreingartView Answer on Stackoverflow
Solution 8 - Pythonbradallen137View Answer on Stackoverflow
Solution 9 - PythonCristian SalameaView Answer on Stackoverflow
Solution 10 - PythonGregView Answer on Stackoverflow
Solution 11 - PythonPratik PatelView Answer on Stackoverflow
Solution 12 - PythonDaren ThomasView Answer on Stackoverflow
Solution 13 - PythonKirk StrauserView Answer on Stackoverflow
Solution 14 - PythoncarlView Answer on Stackoverflow