[dev] Proposal for change to Horde's XML-RPC service

Ben Klang ben at alkaloid.net
Thu Jun 22 16:20:10 PDT 2006


Recently I had a desire to allow for automated ticket creation from an
application external to Horde.  Due to the nature of my application I
further needed to be able to submit an attachment with the newly created
ticket.  While the Whups API does allow for this there does not appear
to be a way to format the XML-RPC request that will convince Whups to
include an attachment.

Further inspection of the XML-RPC specification
(http://www.xmlrpc.com/spec) shows that the designers did not
specifically create a "file" data type for transactions.  I believe this
was intentional as one of the stated goals of the specification is
simplicity.  However because of this decision there does not seem to be
a standard way to handle file uploads in XML-RPC requests in any
mechanism similar to the way they are handled with HTTP.

While I could very likely solve this problem by modifying the Whups API
creating a method specific to XML-RPC I feel that such a modification is
the wrong approach.  First the workaround would have to be
re-implemented by all other modules accepting files as inputs and second
it means creating an API call which would likely be useless for any
other calling mechanism.  To fix this across the board I propose
modifying the XML-RPC library in Horde in such a way that any
application which uses Horde_Form and the Horde_Form_Type_file object
can seamlessly work with XML-RPC.

Two solutions have come to mind to effect this change:

1) Create a reserved variable name that is recognized by the XML-RPC
driver as a file upload.  The variable would be a struct and have some
kind of reserved name like "_fileupload" or similar to avoid conflicts
with application variable names.  This has the disadvantage of being a
"one-off" in the sense that the XML-RPC driver today does not do any
processing on the contents of the POSTed data.  It instead immediately
hands it off to the called method for processing.

2) Modify the XML-RPC spec to recognize a special file upload tag.
Unless we can get the buy-in of the XML-RPC community I would prefer to
avoid this route as I'm not usually one to go breaking accepted
standards.  It does, however, have the benefit of being the "cleanest"
approach in my mind as it would be unambiguous to the receiving
application what should be done with the data (in Horde's/PHP's case
that means decoding the Base64 data and writing it to a temp file to be
passed to higher level methods as HTTP form processing does now).

I welcome your thoughts.

/BAK/
-- 
Ben Klang
Alkaloid Networks
404.475.4850
ben at alkaloid.net
http://projects.alkaloid.net



More information about the dev mailing list