Ron Phillips wrote:
> I believe I've tried every setting known to man, in every script in 
> every little scrap of documentation available. XMLRPC requests using 
> SimpleXMLRPCRequestHandler -- no problem. But try to run them as a CGI 
> script, and I get system lock ups and that's all. No error codes; no 
> response whatsoever.
>  
> I am using Python 2.3, Windows XP. I have run other CGI scripts in the 
> same directory, so I know that works.
>  
> Has anyone used this successfully? Can you share demo server and client 
> scripts -- just an echo function or something?

The server example in the docs works for me with one correction:

## cgi-bin/xmlrpc.py

from SimpleXMLRPCServer import CGIXMLRPCRequestHandler

class MyFuncs:
    def div(self, x, y) : return 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()

##
Run a simple CGI server by opening a command line to the parent dir of cgi-bin 
and running
python -c "import CGIHTTPServer; CGIHTTPServer.test()"

## 

>From the command line:

 >>> import xmlrpclib
 >>> server = xmlrpclib.ServerProxy("http://localhost:8000/cgi-bin/xmlrpc.py";)
 >>> server.system.listMethods()
['add', 'div', 'pow', 'system.listMethods', 'system.methodHelp', 
'system.methodSignature']
 >>> server.add(1, 2)
3
 >>> server.pow(2, 10)
1024

Using Python 2.4.1 on Windows 2000

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to