- A two-tuple whose first element begins with "types." should be interpreted as a reference to an object on the server, where the first element specifies the type of the object, and the second is a unique identifier for that object.
- The server exposes object methods as functions with names of the format "typeMethods.typeName.methodName".
class MyClass: def doSomething(self, x, y): pass def makeObj(): return MyClass()would be exposed as these XML-RPC functions:
makeObj() /* returns an object reference: ("types.MyClass", objectId) */ typeMethods.MyClass.doSomething(objectRef, x, y) /* objectRef should be ("types.MyClass", objectId) */When the client sees a two-tuple of the form ("types.MyClass", objectId), it can create a new object along the lines of:
o.doSomething(x,y);instead of something along the lines of:
serverproxy.MyClass_doSomething(objectId, x, y);Using the system.listMethods() function to get a list of all methods supported by the server enables you to bind all of a type's methods to an object. Generating objectId's is application specific, so I won't go into that here. I would like to see a generic way for a user to extend Python's SimpleXMLRPCServer to marshall and unmarshall new data types. The pickle methods (__getstate__, __setstate__) seem promising, but those are intended to serialize the entire representation of an object, not simply a reference to the object.