CGIXMLRPCRequestHandler example

P

Phoe6

I have the following CGIXMLRPCRequestHandler usage example. I have
both the server and the client in the same directory. I based this
following this example: http://mail.python.org/pipermail/python-list/2005-May/320696.html


Server Code: Foo.py

import os
import SimpleXMLRPCServer

class Foo:
def settings(self):
return os.environ
def echo(self, something):
return something

handler = SimpleXMLRPCServer.CGIXMLRPCRequestHandler()
handler.register_instance(Foo())
handler.handle_request()


And the Client which tries to Access it.

import xmlrpclib
server = xmlrpclib.ServerProxy('http://127.0.0.1/Foo.py')
print server
print dir(server)
sometext = 'Hello'
tup = tuple(sometext)
print tup
textcall = xmlrpclib.dumps(tup, ("server.echo"))
print textcall
print server.echo("Hello")


When I call the Client, the call fails at server.echo("Hello") and
says Connection Refused.

socket.error: [Errno 111] Connection refused

Should I do more? The handler is waiting for the requests, but do I
need to run a server or anything? Any pointers appreciated.

Thank you,
Senthil
 
A

Aahz

[posted & e-mailed, please respond on-group]

I have the following CGIXMLRPCRequestHandler usage example.
handler = SimpleXMLRPCServer.CGIXMLRPCRequestHandler()
handler.register_instance(Foo())
handler.handle_request()

What happens when you
telnet localhost 80

If that fails, you haven't set up the server correctly. I don't know
anything about SimpleXMLRPCServer, but you should be able to make
progress using standard HTTP debugging tactics.
--
Aahz ([email protected]) <*> http://www.pythoncraft.com/

"...string iteration isn't about treating strings as sequences of strings,
it's about treating strings as sequences of characters. The fact that
characters are also strings is the reason we have problems, but characters
are strings for other good reasons." --Aahz
 

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
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top