[Twisted-web] Run Nevow and XMLRPC on a single port?

Stephen Waterbury waterbug at pangalactic.us
Thu Dec 14 07:44:24 CST 2006

Phil Mayers wrote:
> Remi Cool wrote:
>> Hello,
>> Is it possible to run a nevow site and and serve XMLRPC (or SOAP)
>> requests on a single port?
>> I've tried to make it work some time ago, but to no avail.
> I believe you can do this:
> class Xrpc(xmlrpc.XMLRPC):
>   def xmlrpc_echo(self, arg):
>     return arg
> xrpc = Xrpc()
> page = NevowRootPage()
> page.putChild('RPC2', xrpc)

That's what I had in my suggestion.  It does give you an xml-rpc
service, sure, but the problem is that NevowSite tries to render
every request it gets, so you'll need to specify a renderer for
the xml-rpc resources that will pass them through unaltered.

But, as I mentioned, you probably also want to do some checking
to prevent browsers from getting xml-rpc gibberish and xml-rpc
clients from getting rendered xhtml ... possibly by giving them
different auth realms.


More information about the Twisted-web mailing list