XML-RPC Bug?
Jesper Olsen
jolsen at mailme.dk
Sun Mar 17 10:17:19 EST 2002
Hola,
With xmlrpclib & SimpleXMLRPCServer it is possible to
call procedures remotly, which return various simple
python types.
If I call a procedure that returns nothing, I get a
"<ProtocolError: 500 Internal error>"
Surely that is a bug?
Example:
Server:
from SimpleXMLRPCServer import *
class MyClass:
def __init__(self):
self.i=0
def inc(self):
self.i+=1
def simpel_server(port=50000):
myobj=MyClass()
server=SimpleXMLRPCServer(("",port))
server.register_instance(myobj)
while myobj.i<5:
server.handle_request()
simpel_server(50000)
Client:
import xmlrpclib
srv=xmlrpclib.ServerProxy("http://localhost:50000")
try:
srv.inc()
srv.inc()
srv.inc()
srv.inc()
srv.inc()
except xmlrpclib.Error, v:
print "Error", v
The example works correctly if MyClass.inc() is changed to
always return a dummy value...
Cheers
Jesper
More information about the Python-list
mailing list