[mod_python] Sessions and Cookies with mod_python and more

Bram bram-lists at phoenux.org
Wed Nov 17 17:44:50 EST 2004


You hit the nail on the head, as I am speaking of XML-RPC. Your form 
example is a good one, and I will take a closer look at 
mod_python.utils.FieldStorage. Thanks for that bit of info. Although, I 
am not sure that it will meet my needs completely. That being said I 
will explain further. I am currently using a mod_perl XML-RPC server 
that was modified to handle large binary files. I have found that 
passing large binary strings in XML via XML-RPC (or any other protocol 
for that matter) even with careful attention to the encoding can lead to 
problems. I know that with XML-RPC one may use the <base64> tag to 
encapsulate binary data directly within the XML document. However, is 
this the best way to handle this when dealing with large files? In my 
mod_perl implementation, I have a multipart/related handing situation 
setup, i.e. the first part of the multipart/related message would be the 
XML-RPC request/reply and the second (and 3rd, 4th, etc. if need) part 
is binary data referenced by the XML-RPC data. I am not saying this is 
the best solution, and may not even adhere to any specification, but I 
haven't found a better one to date. I admit it is a little hackish. :) 
Any suggestions to improve upon this, or even suggestions totally 
rethinking it? In short, what would be an efficient way to transfer 
large files via an XML based, standards based web service like XML-RPC?

Thanks again, and in advance!

Graham Dumpleton wrote:

>On Nov 17 10:27, Bram <bram-lists at phoenux.org> wrote:
>>Subject: [mod_python] Sessions and Cookies with mod_python and more
>>2. Any ideas on how to write a mod_python XMLRPC handler that is capable 
>>of sending/receiving multipart/related data. For those of you not 
>>familiar with multi part messages, see this: 
>>http://www.xml.com/lpt/a/98/07/binary/binary.html . multipart messages 
>>were created for use with email systems, and have been used to send 
>>binary payloads along with XML messages like XMLRPC. I have implemented 
>>this type of handler in mod_perl, but I am looking for any mod_python 
>>related insight into this before porting. Anyone?
>Be careful about referring to this as XMLRPC as people will possibly think
>you are talking about XML-RPC which is different. The original RPC over
>HTTP protocol called "XML-RPC" has no support for multipart messages.
>Information about XML-RPC can be found at:
>  http://www.xmlrpc.com
>Anyway, you might as a start, look at:
>  mod_python.utils.FieldStorage
>This is primarily intended for handing HTML forms, but if one is doing file
>uploads one uses a form encoding type of "multipart/form-data" which starts
>to be more like what you want as boundaries will be put in the posted data
>allowing elements of different types to be include in the one POST request.
>You may be able to fit what you are doing into this model and use that
>class as a base or at least get ideas from it.
>Graham Dumpleton (grahamd at dscpl.com.au)

More information about the Mod_python mailing list