Hi all,
I think this is a very simple problem.. I'm trying to run an xml-rpc
server given in SimpleXMLRPCSer ver.py file that comes with Python and
wrote a very simple client to interact with it but it's giving me
errors.
The server code is as follows:
#!/usr/local/bin/python2.2
from SimpleXMLRPCSer ver import *
# Install an instance with custom dispatch method:
class Math:
def _dispatch(self, method, params):
if method == 'pow':
return apply(pow, params)
elif method == 'add':
return params[0] + params[1]
else:
raise 'bad method'
server = SimpleXMLRPCSer ver(("localhost ", 8000))
server.register _instance(Math( ))
server.serve_fo rever()
Client code:
#!/usr/local/bin/python2.2
import xmlrpclib
myserver = xmlrpclib.Serve r("http://localhost:8000" )
p= [2,2]
print myserver._dispa tch("add",p)
The error I get:
.......
.......
xmlrpclib.Fault : <Fault 1: 'bad method:None'>
What have I done wrong?
Thanks
Ben
I think this is a very simple problem.. I'm trying to run an xml-rpc
server given in SimpleXMLRPCSer ver.py file that comes with Python and
wrote a very simple client to interact with it but it's giving me
errors.
The server code is as follows:
#!/usr/local/bin/python2.2
from SimpleXMLRPCSer ver import *
# Install an instance with custom dispatch method:
class Math:
def _dispatch(self, method, params):
if method == 'pow':
return apply(pow, params)
elif method == 'add':
return params[0] + params[1]
else:
raise 'bad method'
server = SimpleXMLRPCSer ver(("localhost ", 8000))
server.register _instance(Math( ))
server.serve_fo rever()
Client code:
#!/usr/local/bin/python2.2
import xmlrpclib
myserver = xmlrpclib.Serve r("http://localhost:8000" )
p= [2,2]
print myserver._dispa tch("add",p)
The error I get:
.......
.......
xmlrpclib.Fault : <Fault 1: 'bad method:None'>
What have I done wrong?
Thanks
Ben
Comment