xmlrpclib

S

sashan

Hi

I'm having trouble using xmlrpclib. I register a function (or class)
with the SimpleXMLRPCServer and initiate the server. I then create a
ServerProxy object and connect to the xml-rpc server. When I call a
registerd function or class member function I get the follwoing error.
I've attached the server and client source files.


File "D:\Python23\lib\xmlrpclib.py", line 742, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: 'exceptions.TypeError:cannot marshal None
unless allo
w_none is enabled'>

Thanks


from SimpleXMLRPCServer import SimpleXMLRPCServer

class A(object):
def f(self):
print 'A'

def g():
print 'g'

def main():
server = SimpleXMLRPCServer(("",2001))
server.register_function(g)
server.register_instance(A())
server.serve_forever()

if __name__ == '__main__':
main()

from xmlrpclib import ServerProxy

def main():
sp = ServerProxy('http://localhost:2001')
print sp.f()

if __name__ == '__main__':
main()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top