Python and SOAP

Python isn’t especially known for its support of soap functionality, but that’s usually not a problem as most folks needing that sort of functionality are using REST or XML-RPC. However, in case where you need SOAP functionality, such as using UCLA’s ISIS service, there are a few options.

Notably, there are

  1. Optio’s soaplib
  2. PythonWare’s SOAP for Python
  3. ZSI: The Zolera Soap Infrastructure (used to be SOAPpy)

(here’s an outdated, but interesting comparison by IBM’s developerWorks: Python Soap )

Optio’s soaplib is a great toolkit, and easy to learn. However, it doesn’t (yet) support an easy way of handling a complex WSDL, which means a lot of headache if you’re trying to talk a complex webservice.

ZSI is a more complicated tool, but handles a WSDL gracefully (and using wsdl2py, it will create a python class for you from a remote URL, and even supports SSL!). The biggest hurdle to using it was that, up until version 2.1 alpha 1, ZSI had built off of PyXML which was a nice little XML parser, but is no longer maintained and even conflicts with built in XML parsers in modern releases of Python. However, as of version 2.1a1, ZSI is now built off of minidom, which is maintained and might even be built into your version of Python (such as in OS X 10.5 Leopard).