Communicating between two computers

David Bolen db3l at fitlinxx.com
Mon Jul 3 15:20:27 EDT 2000


"donotspam-jen at personic.com" <dnotspam-jen at personic.com> writes:

> I checked out the link, but from what I read, it sounds like this is a
> client-side implementation only.  Is there more info on this somewhere?
> Maybe some examples of how to use this?

It can handle both client and server.  The package has both the
xmprpclib.py module (client) as well as a sample xmlrpcserver.py
module (all 50 lines of it, excluding the preface comments).

Just "borrow" the server example module, add your methods into the
RequestHandler class and you're off.  On the client side, it's no more
than a single Server() instantiation, e.g.:

	server = xmlrpclib.Server("http://hostname")

and then you can call any method you want directly, e.g.:

	server.myMethod(myParameters)

any exceptions on the server side are trapped and and exception type
and value are returned as a "fault" return code.

BTW, this isn't much different from the other suggestions to subclass
the HTTP server object (in fact that's what RequestHandler in the
server example does), but the automatic translation back and forth
from any Python objects into XML for transmission/receipt saves a lot
of time in actually formatting and processing the request over the
stream.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list