[Twisted-Python] Newbie:XMLRPC Server as plugin?

Nesbitt, Steve snesbitt at cobaltgroup.com
Thu Sep 18 13:27:12 EDT 2003

Thanks Itamar.

I've been reviewing the howto and have that working.

My next step, however, was to turn that example into an actual plugin
following the QuoteD plugin example which has three parts:
- quoters.py => contains business logic
- quoteproto.py => contains the protocol definition
- quotetap.py => application interface/wrapper

My problem is coming up with the xmlrpc equivalent of quoteproto.py which
looks like this:

from twisted.internet.protocol import Factory, Protocol
from twisted.internet.app import Application

class QOTD(Protocol):

    def connectionMade(self):

class QOTDFactory(Factory):

    protocol = QOTD

    def __init__(self, quoter):
        self.quoter = quoter

What I can't figure out what this should look like for an xmlrpc server. It
appears (to me at least) that a fundamental function of the factory method
is to set the protocol. But I don't know what this should be for xml-rpc and
since twisted appears to do the right thing already, I don't really want to
rewrite the connectionMade, etc. methods.

I suppose the core issue is that in order to create a plugin I need to call:
app.listenTCP(port, factory) and I don't know what factory object to pass or
how to get it.



Steve Nesbitt
Senior Configuration Manager
The Cobalt Group
snesbitt at cobaltgroup.com

-----Original Message-----
From: Itamar Shtull-Trauring [mailto:itamar at itamarst.org]
Sent: Thursday, September 18, 2003 10:10 AM
To: twisted-python at twistedmatrix.com
Subject: Re: [Twisted-Python] Newbie:XMLRPC Server as plugin?

On Thu, 18 Sep 2003 09:47:40 -0700
"Nesbitt, Steve" <snesbitt at cobaltgroup.com> wrote:

> I would like to implement an XML-RPC server as a plugin (using the
> QuoteD how-to as an example) and can't figure out how to do so. In
> particular I don't understand how to create the protocol created as
> part of the factory.

Protocols are created by the factory when the port you are listening
gets an incoming connection - the factory's buildProtocol is called and
the resulting protocol is connected to the transport for the new

In any case, Twisted already has a nice XML-RPC server framework,
documented at http://twistedmatrix.com/documents/howto/xmlrpc - it
should support anything you might want to do with a XML-RPC server.

Itamar Shtull-Trauring    http://itamarst.org/
Available for Python & Twisted consulting

Twisted-Python mailing list
Twisted-Python at twistedmatrix.com

This e-mail transmission contains information intended only for the use of
the recipient(s) named above. Further, it contains information that may be
privileged and confidential. If you are not the intended recipient, you are
hereby notified that any dissemination, distribution, or copying of this
message (including any attachments) is strictly prohibited. If you have
received this e-mail in error, please notify the sender by reply e-mail and
then delete this message from your mail system. Thank you for your

More information about the Twisted-Python mailing list