xmlrcp - how to marshall objects

Adam Tauno Williams awilliam at opengroupware.us
Fri Feb 5 17:52:57 CET 2010


On Fri, 2010-02-05 at 17:03 +0100, Jean-Michel Pichavant wrote:
> Deos anyone knows where to find an code sample describing how to 
> implement the interface to marshall one object into XMLRPC compliant 
> structures ?
> I googled without any success, and what google does not find does not exist.
> Let say I have this very simple class:
> class Point:
>     def __init__(self, x, y):
>     self.x = x
>     self.y = y

You have to be more specific about what you want to do; "marshall" is a
fairly generic term.  XML-RPC isn't CORBA; typically you don't remote
persistent objects you just make individual calls.

> I've looked into xmlrpc code, I see  2 options:
> 1/ override the Marshaller class of client and server
> 2/ looks like the lib is supporting a WRAPPER list system, it uses to 
> Marshall Datetime & Binary object. Can it be possible to add its own 
> class (could require to emplement the 'encode' method)
> I sense I will spend much more time than required unless someone is 
> pointing me in the right direction.

You can use the loads and dumps methods to process the XML-RPC call
anyway you like.
<http://coils.hg.sourceforge.net/hgweb/coils/coils/file/22c023c8e0f5/src/coils/net/xmlrpc.py>
-- 
OpenGroupware developer: awilliam at whitemice.org
<http://whitemiceconsulting.blogspot.com/>
OpenGroupare & Cyrus IMAPd documenation @
<http://docs.opengroupware.org/Members/whitemice/wmogag/file_view>




More information about the Python-list mailing list