XML-RPC - instance

Graham Dumpleton grahamd at dscpl.com.au
Wed May 26 02:24:01 EDT 2004


Manuel Huesser <sylphaleya at gmx.net> wrote in message news:<pan.2004.05.25.13.11.00.533276 at gmx.net>...
> Currently it's possible to register a single functions or a an instance in
> the standard XML-RPC library. Is there a possibility to refer to
> a different instance, like in a session. Should be possible with HTTP/1.1,
> but I haven't an idea.
> 
> If not with XML-RPC, are there other ways.

With the simple XML-RPC server that is provided with Python, most people
probably do this by having each method which is to operate on an instance,
to require a first parameter which identifies the instance to use.

Another approach which can be used is not necessarily straight forward
with the simple XML-RPC server included with Python. That is, for
different instances of a service or object which you want to manipulate
being referenced under a different URL. You should be able to do it, but you
would have to override the method dispatch routines to look at the URL
and use it as the basis of selecting some different set of methods or objects
against which the request is executed.

I prefer the latter approach of using different URLs to identify different
fixed services or transient services related to a session. The approach
of using scoping within the method name to identify different services
under the one URL doesn't really cut it for complicated systems.

Although not using the standard Python XML-RPC server, and also not
pure Python for that matter, you might look at the following Python
Cookbook example for an example of how URLs can be used to identify
information pertaining to different sessions.

  http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81613

The example uses different URLs for different database cursor instances.
The underlying framework is flexible enough that in this case the cursor
created for that specific session can be made to expire after a set period
of inactivity as well.

Echoing what another poster said, you would need to clarify perhaps
what you are trying to do.



More information about the Python-list mailing list