Personal tools

Aug 19, 2009

suds: SOAP client that works (also in Plone)

If you need a lightweight SOAP client for consuming web services - you need to try suds.

I'm developing SOAP integration in Plone. I have never used efficiently SOAP python client before so first I wanted to test all of them. According to Plone there are two well-known python SOAP implementations: ZSI and SOAPpy. They are both focused on server not client implementation. It took me some time to configured them properly and found that the last release for ZSI was 2006 (for SOAPpy it was 2005). Finally I found suds. It's fast, light and powerful. And it has a community which is helpful - especially for beginners. 

Installing and using is veery simple. You can use easy_install:

>>> easy_install suds


and use it:

from suds.client import Client
url = 'http://localhost/testingservice.wsdl'
client = Client(url)


than accessing methods is as simple as:

document = client.service.getDocument(id=1)
print document
title = 'Document title'
description = 'Document short description'


even if your webservice has strange method names:

document = getattr(client.service,'get-document')(id=1)
Filed under:
comments powered by Disqus