[Twisted-Python] Question about XMLRPC, Sync and ASync
andrewfr_ice at yahoo.com
Sat Aug 7 14:36:02 EDT 2010
> Message: 1
> Date: Fri, 06 Aug 2010 11:02:33 -0700
> From: Colin Fox <greenenergy at gmail.com>
> Subject: [Twisted-Python] Question about XMLRPC, Sync and
> To: twisted-python at twistedmatrix.com
> Message-ID: <4C5C4E39.6080807 at gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> What I'm trying to do now has me a little stumped -- I have
> two servers, one of which answers XMLRPC requests, and it calls another
> one using the twisted basic.LineReceiver system.
I am a little confused about the basic.LineReceiver because I thought
that was used for creating server protocols?
> So I have an incoming XMLRPC request, and I need to issue a
> command to the other server and wait for it to come back before I
> respond to the xmlrpc call. So I'm trying to do an async call inside a
> synchronous call.
I'm a bit rusty but lets use this simple example of a XMLRPC server
making another XMLRPC request, processing the data and returning it:
self.service = xmlrpc.Proxy("http://www.dude.com")
def xmlrpc_someFunction(self, *argv, **kwargs):
self.service.callRemote returns a deferred. Returning a deferred
tells the reactor that someFunction() is not finished processing and
to call processResult when there is data from www.dude.com
eventually processResult(data) is called
do something with data
This should return a result to the XMLRPC client.
More information about the Twisted-Python