I need complex logic in my application, eg:
- My application is XML-RPC server
- When it received XML-RPC request it needs to do some calculations.
- Then it need to call another one XML-RPC server, and parse it's response.
- Next it need to do some more calculations and
- Return results of step 4 to XML-RPC client.
I solved this case something like that:
from twisted.web import xmlrpc
import xmlrpclib
class RPCProxy(xmlrpc.XMLRPC):
def xmlrpc_do_something(self, param1, param2):
result1 = self.do_some_calc1(param1, param2)
s = xmlrpclib.ServerProxy('http://some.another.server:1234/RPC2')
result2 = getattr(s, 'do_something_else')(result1)
result3 = self.do_some_calc2(result2)
return result3
How should i do this in a Twisted-like way?