T
ted holden
I have a project for which being able to write xmlrpc server code in python
would be vastly preferable to the second choice solution for a number of
reasons. Unfortunately, pretty much everything I see on the net in the way
of documentation appears either insufficient or outdated.
The example given in the Python documentation for SimpleXMLRPCServer is
more or less incomprehensible. That example is as follows:
class MyFuncs:
def div(self, x, y) : return div(x,y)
handler = CGIXMLRPCRequestHandler()
handler.register_function(pow)
handler.register_function(lambda x,y: x+y, 'add')
handler.register_introspection_functions()
handler.register_instance(MyFuncs())
handler.handle_request()
I don't see where the "div(x,y)" which is returned in the class function
definition comes from. I don't see any relationship between the class
MyFuncs and the rest of the program. I don't see where the returned
function "pow" comes from or what its relevance is. I don't see what
"lambda" is or how a lambda function is supposed to be construed as adding
two numbers together. I don't see how this server is supposed to be used.
I also find an example written by Dave Warner:
http://www.onlamp.com/pub/a/python/2001/01/17/xmlrpcserver.html
which is about four years old and dated. In particular, the include file
xmlrpcserver which he imports no longer exists.
And then, I find one example in an IBM reference which actually does work as
stated on a single computer:
http://www-106.ibm.com/developerworks/webservices/library/ws-pyth10.html
The test client provided looks like:
mport xmlrpclib
server = xmlrpclib.ServerProxy("http://localhost:8888")
month = server.getMonth(2002, 8)
print month
which actually works. Nonetheless I need this thing to work across
machines. I have a primitive network here usingVerizon DMS and a Linksys
router which sees the three computers on it as 192.168.1.100,
192.168.1.101, and 192.168.1.102 as usual.
Question is, what does it take to run the server on 102 and a client on 100?
Changing the obvious line in the client program to:
server = xmlrpclib.ServerProxy("http://192.168.1.102:8888")
doesn't work. Aside from that, I'd like to get the CGI version of the thing
which uses .py files in the CGI bin to work as well and again the only
example I see of that (in the Python documentation) is undecipherable.
I'd appreciate any suggestions or info anybody might have.
would be vastly preferable to the second choice solution for a number of
reasons. Unfortunately, pretty much everything I see on the net in the way
of documentation appears either insufficient or outdated.
The example given in the Python documentation for SimpleXMLRPCServer is
more or less incomprehensible. That example is as follows:
class MyFuncs:
def div(self, x, y) : return div(x,y)
handler = CGIXMLRPCRequestHandler()
handler.register_function(pow)
handler.register_function(lambda x,y: x+y, 'add')
handler.register_introspection_functions()
handler.register_instance(MyFuncs())
handler.handle_request()
I don't see where the "div(x,y)" which is returned in the class function
definition comes from. I don't see any relationship between the class
MyFuncs and the rest of the program. I don't see where the returned
function "pow" comes from or what its relevance is. I don't see what
"lambda" is or how a lambda function is supposed to be construed as adding
two numbers together. I don't see how this server is supposed to be used.
I also find an example written by Dave Warner:
http://www.onlamp.com/pub/a/python/2001/01/17/xmlrpcserver.html
which is about four years old and dated. In particular, the include file
xmlrpcserver which he imports no longer exists.
And then, I find one example in an IBM reference which actually does work as
stated on a single computer:
http://www-106.ibm.com/developerworks/webservices/library/ws-pyth10.html
The test client provided looks like:
mport xmlrpclib
server = xmlrpclib.ServerProxy("http://localhost:8888")
month = server.getMonth(2002, 8)
print month
which actually works. Nonetheless I need this thing to work across
machines. I have a primitive network here usingVerizon DMS and a Linksys
router which sees the three computers on it as 192.168.1.100,
192.168.1.101, and 192.168.1.102 as usual.
Question is, what does it take to run the server on 102 and a client on 100?
Changing the obvious line in the client program to:
server = xmlrpclib.ServerProxy("http://192.168.1.102:8888")
doesn't work. Aside from that, I'd like to get the CGI version of the thing
which uses .py files in the CGI bin to work as well and again the only
example I see of that (in the Python documentation) is undecipherable.
I'd appreciate any suggestions or info anybody might have.