[Twisted-Python] Twisted and SOAP

Landreville landreville at deadtreepages.com
Wed Sep 1 11:58:01 EDT 2010

On Wed, Sep 1, 2010 at 1:16 AM, Einar S. Idsø
<einar.twisted at norsk-esport.no> wrote:
> Well, at least I've found that the interest in SOAP in the Twisted
> community is not very great ;) And understandably so. Unfortunately,
> however, sometimes Twisted apps do need to talk to alternative
> protocols, so it is a pity there's no recommended way of doing this.
> For future reference: I ended up using suds with the following wrapper
> provided to this list in April by Landreville. It seems to be working
> great, so thanks Landreville :)
> """ Wrapper for suds to create deferred instances. """
> from suds.client import Client as SudsClient
> from twisted.internet.threads import deferToThread
> class Client(SudsClient):
>   # method for returning a deferred for the RPC
>   def callRemote(self, method, *args, **kwargs):
>       def call(m, *a, **kw):
>           result = self.service.__getattr__(m)(*a, **kw)
>           return result
>       d = deferToThread(call, method, *args, **kwargs)
>       return d
> Cheers,
> Einar

That's pretty much what I did as well. There is twisted.web.soap, but
it uses SOAPpy which is awful -- Suds is much better. If you take a
look at its insides though you can see how they are turning it into a
deferred in a better way than just deferToThread.

More information about the Twisted-Python mailing list