xml-rpc, O'Reilly cookbook example not working???
Francois at iecholden.com
Tue Jan 7 03:59:51 CET 2003
In the process of learning Python, I bought the O'Reilly cookbook. I am
curious about xml-rpc, tried the example 13.2 and 13.3, they worked as long
as the client and server were on the same machine. Since rpc stands for
remote procedure, I tried to run with the client and server on different
The server does not respond to remote query, did also try telnetting the
ports, always gets "connection failed".
Here is the first example code:
# server coder sxr_server.py
# needs Python 2.2 or the XML-RPC package from PythonWare
# Make all of the Python string functions available through
self.python_string = string
# This function cannot be called directly through XML-RPC because
# it starts with an underscore character '_', i.e., it's "private"
def chop_in_half(self, astr):
def repeat(self, astr, times):
return astr * times
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8000))
server.register_function(lambda astr: '_' + astr, '_string')
More information about the Python-list