XML-RPC + SimpleHTTPServer question

jbrewer jeremy.d.brewer at gmail.com
Wed Jul 5 13:34:30 EDT 2006


I'm currently implementing an XML-RPC service in Python where binary
data is sent to the server via URLs.  However, some clients that need
to access the server may not have access to a web server, and I need to
find a solution.  I came up with the idea of embedding a simple HTTP
server in the XML-RPC clients so that files can be sent in the
following way:

1.  Start an HTTP server on the client using e.g SImpleHTTPServer on a
user allowed port
2.  Call XML-RPC server with the URL to the file on the client to
upload
3.  Get XML-RPC server response, then shut down HTTP server on client

Does this sound reasonable?  I know that XML-RPC can send binary data,
but I presume that the URL method would be faster because the XML
parser could skip reading the binary file (is it base64 encoded as a
string like in SOAP?).

Anyway, I'm unsure of how to implement this in Python.  In particular,
how do I shut down a web server once I've started it with
server_forever()?  Should I run the server in a separate thread or run
it asynchronously?  Since I'm only uploading one file I don't really
need to handle multiple clients; I just need to be able to shut the
server down once remote call has finished.

Any help would be appreciated since I'm new to network programming.

Jeremy




More information about the Python-list mailing list