Reputation: 169
I need to send an object through XML-RPC in python. My object consist of composite data type to populate a tree structure:
class Node(object):
'''Composite data type '''
def __init__(self, pData, pParent=None):
self.mData = pData
self.mParent = pParent
self.mChildren = []
self.mParent
is reference to its parent node. So I have a recursive data structures to create this structure. When I try to send this data type directly by XML-RPC, it gives this error:
xmlrpclib.Fault: <Fault 1: "<type 'exceptions.TypeError'>:cannot marshal recursive dictionaries">
I think this exception raised due to its complex structure. Because xml-rpc supports only basic data types. I couldn't use dictionaries, because I need to have the references in my client peer. When i use dictionaries with references, it gives the same error above. I couldn't use pickle, It needs to be language independent.
Do you have any suggestion to send an object through XML-RPC natively? Maybe how to create my own data type to send it in xml format?
Upvotes: 0
Views: 2550
Reputation:
Look at
http://www.xs4all.nl/~irmen/pyro3/
when you want to transfer Python objects over the wire.
Since XMLRPC is based on XML -as the name implies - you can not transfer Python objects over the wire without serialization.
Upvotes: 1