XML-RPC server via xinetd

Jean-Paul Calderone exarkun at divmod.com
Mon Apr 17 09:05:00 EDT 2006


On Mon, 17 Apr 2006 14:17:51 +0200, Jos Vos <jos at xos.nl> wrote:
>On Mon, Apr 17, 2006 at 12:42:00PM +0200, Fredrik Lundh wrote:
>
>> except that if the OP's expecting the other end to use an ordinary XML-RPC
>> library, he needs to implement some minimal HTTP handling as well.
>
>Which makes me wondering why the classes (this also applies to
>BaseHTTPServer / BaseHTTPRequestHandler) ae designed the way they
>are.  The underlying stream medium (TCP sockets or plain file
>streams like stdin/stdout) should not be integrated with the
>protocol (HTTP) handling, IMHO...
>

Twisted agrees.  A server that speaks real HTTP and real XML-RPC over stdin and stdout (untested ;):

    from twisted.web import xmlrpc, server
    from twisted.internet import stdio, reactor

    class YourApplication(xmlrpc.XMLRPC):
        def remote_somefunction(self, args):
            ...
            return result

    stdio.StandardIO(server.Site(YourApplication()))
    reactor.run()

For more details, see <http://twistedmatrix.com/>.

Jean-Paul



More information about the Python-list mailing list