question soap and classes

Scott Hathaway scott_hathaway at riskvision.com
Fri Dec 21 07:56:26 EST 2001


Thanks for the reply.  I looked at the OSE project.  I think I will just
make a wrapper class and only expose it to the world with SOAP.

:)
Scott

"Graham Dumpleton" <grahamd at dscpl.com.au> wrote in message
news:dc6f5c99.0112201800.4e665684 at posting.google.com...
> "Scott Hathaway" <scott_hathaway at riskvision.com> wrote in message
news:<BGoU7.32$pZ.58542 at news.uswest.net>...
> > I want to create a soap server that will expose many classes and then
acces
> > them as follows:
> >
> > client:
> >
> > import SOAP
> > if SOAP.Config.SSLserver:
> >  from M2Crypto import SSL
> > SOAP.Config.debug = 1
> > SOAP.Config.BuildWithNoType = 1
> > SOAP.Config.BuildWithNoNamespacePrefix = 1
> > s = SOAP.SOAPProxy("http://localhost:8800")
> > u1 = s.classA.Login('joe','smith')
> > u2 = s.classB.Logout('joe','smith')
> >
> > ...
> >
> > This does not allow me to access separate classes.  Can anyone tell me
the
> > best way to do what I want?
>
> Looking at the source code you have:
>
>     def registerObject(self, object, namespace = ''):
>         if namespace == '': namespace = self.namespace
>         self.objmap[namespace] = object
>
> And then when it tries to dispatch things:
>
>                     else: # Now look at registered objects
>                         # Check for nested attributes. This works even if
>                         # there are none, because the split will return
>                         # [method]
>                         f = self.server.objmap[ns]
>                         l = method.split(".")
>                         for i in l:
>                             f = getattr(f, i)
>
> Ie., it looks like the only way you can distinguish objects is by
registering
> them against different namespaces. If this is the case you wouldn't be
able
> to use the client calling sequence you are using as you would need have
separate
> proxy objects for each remote object, each with a different namespace
being
> specified.
>
> Anyway, this is a guess based on looking at the code only.
>
> Personally, I don't like how namespaces are used in this way. I prefer a
> model whereby different objects are registered against distinct URLs.
Using
> namespaces like this though has come about as most systems only have one
URL
> entry point and thus object identification has had to be piggy backed on
> using other means.
>
> If you are interested in alternative SOAP frameworks for Python you might
> have a look at OSE. In particular have a look at the examples:
>
>   http://ose.sourceforge.net/example-programs/transient-client.py
>   http://ose.sourceforge.net/example-programs/transient-service.py
>
> These don't actually use SOAP but an XML-RPC like protocol, but it is a
one
> or two line change in each to have it use SOAP or XML-RPC instead. In the
> example it shows dynamic creation of new objects against distinct URLs but
> they could just as easily be set up in advance. Setting up static objects
> or services is actually the norm and you can find a mumber of other
examples
> on the web site of that.
>
> The main OSE site is:
>
>   http://ose.sourceforge.net





More information about the Python-list mailing list