Using Python xmlrpclib to build XMLRPC clients for a server withvariable RPC names

  • Thread starter John P. Crackett
  • Start date
J

John P. Crackett

I need to write prototype XMLRPC clients using xmlrpclib for a server
that has variable RPC names and I'd like to use Python as the
prototyping tool. I've searched but can't find any relevant advice
online. Any pointers would be gratefully received; details follow.

The server in question constructs method names dynamically using the
names of objects created by the client. Since the xmlrpclib ServerProxy
object uses methods mirroring the RPC names I would need to be able to
do the following:

api = xmlrpclib.ServerProxy(serverURL)

api.createObject("foo")

api.foo.callOne()

where I don't know what "foo" will actually be in advance.

As an added complication, object names need to be concatenated using "-"
as a separator to form compound RPC names. Following on from the
example above, this could lead to:

api = xmlrpclib.ServerProxy(serverURL)

api. createObjects("foo", "far")

api.foo-bar.callOne()

Where I don't know, again, what "foo" and "bar" will actually be in
advance. "foo-bar" is obviously not a valid Python method name and this
is preventing me from hard-coding just to get a prototype going.

Is Python + xmlrpclib usable under these circumstances? If so, a
pointer in the right direction would be appreciated.

Apologies if there's some glaringly obvious way of doing this that I
have overlooked - I'm new to Python. Many thanks in anticipation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top