[Twisted-Python] SOAP and XML-RPC stuff

Andrew Bennetts andrew-twisted at puzzling.org
Mon May 26 01:15:34 MDT 2003


On Sun, May 25, 2003 at 10:01:57PM -0600, Andrew Dalke wrote:
> http://www.twistedmatrix.com/documents/howto/xmlrpc
> 
> Has a link under
> 
>  "In addition, XML-RPC published methods can return  
> twisted.python.defer.Deferred"
> 
> The last word is hyperlinked to
>    
> http://twistedmatrix.com/documents/TwistedDocs/current/api/public/ 
> twisted.python.defer.Deferred.html
> 
> which does not exist.

Thanks -- fixed in CVS.

> http://twistedmatrix.com/documents/TwistedDocs/current/api/public/ 
> twisted.web.xmlrpc.XMLRPC.html
> says
>  Faults,  Binray, Boolean, DateTime, Deferreds, or Handler instances.
> 
> typo: "Binray" --> "Binary"

Ditto.

> Here's a patch to work with SOAPpy 0.10

I'll let someone else more knowledgeable comment on this.

> How do I run both an XML-RPC and a SOAP server on the same server?
> I tried something like
> 
> def main():
>     from twisted.internet.app import Application
>     app = Application("xmlrpc")
> 
>     r = XMLRPC_Calc()
>     app.listenTCP(7080, server.Site(r))
> 
>     r = SOAP_Calc()
>     app.listenTCP(7080, server.Site(r))

Obviously you can't have multiple things listening on port 7080.  Perhaps
this should raise an exception, though, so as to not seem like it can.

Here you've constructed two seperate server.Site instances, i.e. Twisted Web
HTTP servers, but what you want is one Twisted Web server that does multiple
things.

> But that doesn't work - the SOAP requests go to the XML-RPC server.
> Is there some way to say that "/RPC2" is for XML-RPC and that "/SOAP"
> is for SOAP?

I suspect you can probably do:

    from twisted.web.resource import Resource
    
    root = Resource()           # An empty resource
    site = server.Site(root)
    root.putChild('RPC2', XMLRPC_Calc())
    root.putChild('SOAP', SOAP_Calc())
    
    app.listenTCP(7080, site)

-Andrew.





More information about the Twisted-Python mailing list