[mod_python] XML-RPC?

Michael mogmios at mlug.missouri.edu
Wed Feb 25 14:23:47 EST 2004


Any idea what I'm doing wrong here? I've tried both just pasting this 
HTTP data to the server and using the below client code to make the 
connection. Either way I get a ResponseError from the server code - from 
the xmlrpclib. If I have the server print the POST data it has read it 
looks correct. If I paste the POST data from that into a Python script 
and run it through xmlrpclib.loads() it works fine. What is wrong?

client
------
server = xmlrpclib.ServerProxy ( 'http://localhost/mike.py', verbose = 
True )

try:
        print server.testing ( 41 )
except xmlrpclib.Error, e:
        print 'ERROR:', e


server
------
def handler ( req ):
        req.content_type = "text/xml"
        req.send_http_header ()
        data = req.read ()
        try:
                params, method = xmlrpclib.loads ( data )
        except xmlrpclib.ResponseError, e:
                req.write ( xmlrpclib.dumps ( e ) )
        return apache.OK


>>I want to use Mod_Python to implement an XML-RPC server. Am I right in 
>>trying to use CGIXMLRPCRequestHandler for that? How do I get the POST 
>>data from Mod_Python so I can run it through the XML-RPC handler? Thanks.
>>    
>>
>
>I use xmlrpclib together with the xmlrpc_registry (by Eric Kidd), but I
>guess it works for any xmlrpc handler.
>
>params, method = xmlrpclib.loads(req.read())
>  
>



More information about the Mod_python mailing list