Setting up test for XML-RPC

Skip Montanaro skip at pobox.com
Sat Jan 10 19:36:21 CET 2004


    MB> OK, I tried the obvious and it worked.  : ) I just changed the call
    MB> to server.pow(3,5) and it returns the correct result.  I wonder why
    MB> they aren't set up that way in the first place.

The xmlrpclib module predates SimpleXMLRPCServer by a fair amount.  The
getStateName() test was meant to connect to UserLand's original test server.
As I recall, that was the sole function it exported.  I don't see any reason
why SimpleXMLRPCServer needs to implement getStateName(), but I imagine it
would be reasonable for xmlrpclib's test to call pow().

    MB> But the second question still stands.  I am running both the client
    MB> and server on my own machine now (Windows 2000).  Would I just need
    MB> Python and web server if they were different machines?  I would like
    MB> to avoid installing a bunch of software on the 20 machines if
    MB> possible.

You should be able to build a server and a client with just the standard
Python distribution.  If performance is an issue (it will be if you are
passing large chunks of data back and forth), there are some things you can
do to speed it up:

    * Install Fredrik Lundh's sgmlop module.

    * Marshal or pickle your data first, then base64 encode them before
      passing them to or fro.  This greatly reduces the number of XML tags
      on-the-wire, and thus the encode/decode time and data size.
      Obviously, this only works if you are talking Python-to-Python.

    * Tweak things to gzip-encode the traffic between server and client.

    * Use the xmlrpclib.MultiCall class to bundle logical multiple calls
      into a single physical XML-RPC call.

Skip




More information about the Python-list mailing list