Nick Craig-Wood wrote: > Look at /usr/lib/python2.4/SimpleXMLRPCServer.py (adjust as per your > distro) and in particular the definition of the CGIXMLRPCRequestHandler class. > > That looks as thought it almost, or maybe completely, does what you > want, ie an XMLRPC subclass which reads from stdin and writes to > stdout.
except that if the OP's expecting the other end to use an ordinary XML-RPC library, he needs to implement some minimal HTTP handling as well. import sys import mimetools, xmlrpclib command = sys.stdin.readline() # optional: check command syntax (POST url HTTP/1.X) headers = mimetools.Message(sys.stdin) # optional: check content-type etc bytes = int(headers.get("content-length", 0)) # optional: check request size, etc params, method = xmlrpclib.loads(sys.stdin.read(bytes)) # handle the method result = ... # marshaller expects a tuple result = (result, ) response = xmlrpclib.dumps(result, methodresponse=1) print "HTTP/1.0 200 OK" print "Content-Type: text/xml" print "Content-Length:", len(response) print print response (based on code from http://effbot.org/zone/xmlrpc-cgi.htm ) </F> -- http://mail.python.org/mailman/listinfo/python-list