XML-RPC + SimpleHTTPServer question

jbrewer jeremy.d.brewer at gmail.com
Wed Jul 5 16:02:52 EDT 2006


Fredrik Lundh wrote:

> the XML-RPC protocol uses HTTP POST, so if you can handle XML-RPC, you
> should be able to handle any POST request.  what server are you using ?

I need some clarification of your suggestion.  Instead of sending URLs,
I could read the file as a string, create a Binary object, and send
that via XML-RPC.  The parameters will be sent to the server via HTTP
POST.  However, the file will be encoded as a base64 string and
included in the body of the XML-RPC message, so it will have to be
parsed by the server.  In my experience with SOAP, I have found this to
be extremely inefficient.

Are you suggesting sending the file separately thought a 2nd HTTP POST
with no XML-RPC message body?  I guess the POST request would look
something like:

POST /path/file HTTP/1.0
From: ...
User-Agent: ...
Content-Type: /application/binary
Content-Length: <file size>

<file contents>

I'm not sure how to add a 2nd request like this.  How would I alter a
simple call like that below to inlcude the 2nd post?  Do I need to use
httplib and the request() method of HTTPConnection?  Or can I make
POSTs through a ServerProxy object?

import xmlrpclib
server = xmlrpclib.ServerProxy("http://myserver")
result = server.my_function(file, params)

Jeremy




More information about the Python-list mailing list