From dave at ci.com.au Tue Mar 22 07:25:35 2011
From: dave at ci.com.au (Dave Dodd)
Date: Tue, 22 Mar 2011 17:25:35 +1100
Subject: [Soap-Python] soaplib-2.0.0-beta2 namespace problems in responses
Message-ID: <20110322062535.GD13183@mippet.ci.com.au>
Gentlefolk,
I have been tasked with replacing an existing set of SOAP services and I have
been experimenting with the using soaplib-2.0.0 beta 2 to do so via a wgsi
handler talking to a Mongrel2 webserver. My handler is using the m2wsgi
python library programatically and is retrieving data from MongoDB instance
via pymongo. Not too shabby for someone without any real experience with
python or SOAP :)
I have been using soapUI to do my testing which all works as expected,
except I am getting odd namespace prefixes in the responses generated by
soaplib.
I think I have set the namespace for my services correctly in my use of the
soaplib.core.Application function as follows:
soapapplication = soaplib.core.Application([ClientService], 'eas')
The guts of a request looks like this:
TESTACC
12345
The response I get includes:
Unknown
Are the tns & s1 namespaces shwoing in the response correct ?
I expected to see the eas namespace I had specified in the call to
soaplib.core.Application().
I have attahced the script I am using.
-- Dave
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dgdsoaptest.py
Type: text/x-python
Size: 2727 bytes
Desc: not available
URL:
From ben.lopatin at wellfireinteractive.com Tue Mar 22 17:07:53 2011
From: ben.lopatin at wellfireinteractive.com (Ben Lopatin)
Date: Tue, 22 Mar 2011 12:07:53 -0400
Subject: [Soap-Python] soaplib-2.0.0-beta2 namespace problems in
responses
In-Reply-To: <20110322062535.GD13183@mippet.ci.com.au>
References: <20110322062535.GD13183@mippet.ci.com.au>
Message-ID:
Hi Dave,
As long as the values for the namespace schemaLocation match, I don't think
different namespace prefixes should post any problems.
-Ben
On Tue, Mar 22, 2011 at 2:25 AM, Dave Dodd wrote:
> Gentlefolk,
>
> I have been tasked with replacing an existing set of SOAP services and I
> have
> been experimenting with the using soaplib-2.0.0 beta 2 to do so via a wgsi
> handler talking to a Mongrel2 webserver. My handler is using the m2wsgi
> python library programatically and is retrieving data from MongoDB instance
> via pymongo. Not too shabby for someone without any real experience with
> python or SOAP :)
>
> I have been using soapUI to do my testing which all works as expected,
> except I am getting odd namespace prefixes in the responses generated by
> soaplib.
>
> I think I have set the namespace for my services correctly in my use of the
> soaplib.core.Application function as follows:
>
> soapapplication = soaplib.core.Application([ClientService], 'eas')
>
> The guts of a request looks like this:
>
>
> TESTACC
> 12345
>
>
> The response I get includes:
>
>
>
>
> Unknown
>
>
>
>
> Are the tns & s1 namespaces shwoing in the response correct ?
>
> I expected to see the eas namespace I had specified in the call to
> soaplib.core.Application().
>
> I have attahced the script I am using.
>
> -- Dave
>
> _______________________________________________
> Soap mailing list
> Soap at python.org
> http://mail.python.org/mailman/listinfo/soap
>
>
--
Ben Lopatin
www.wellfireinteractive.com
ben.lopatin at wellfireinteractive.com
571.482.8801
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From chris at sydneysys.com Tue Mar 22 18:00:01 2011
From: chris at sydneysys.com (Chris Austin)
Date: Tue, 22 Mar 2011 12:00:01 -0500
Subject: [Soap-Python] soaplib-2.0.0-beta2 namespace problems in
responses
In-Reply-To: <20110322062535.GD13183@mippet.ci.com.au>
References: <20110322062535.GD13183@mippet.ci.com.au>
Message-ID: <4D88D591.30503@sydneysys.com>
Hi David,
First the quick and unfulfilling answer :):
Yes, the namespace prefixes look correct to me based on how you declared
the models and your application.
Now for an explanation;
What has happened here is that you've found one of the subtleties of xml
namespaces, namespace prefixes and soaplib.
(You can think xml namespaces as something similar to python
namespaces. They provide uniquely qualified and named elements within a
document.)
If you look at the root element in your soapui response you should see
something like:
Here, xmlns:tns="eas" is declaring a namespace prefix "tns" for the
namespace you created called "eas". Also, xmlns:s1="letterstatus" is
declaring a namespace for "letterstatus" and binding it to the prefix "s1".
"letterstatus" is being created because in your model LetterStatus
explicitly declared itself belonging to the namspace "letterstatus" with
this line:
class LetterStatus(ClassModel):
__namespace__ = "letterstatus"
...
...
If you wish to have LetterStatus belong to the namespace "eas" you need
to be explicit about it and modify your namespace declaration. I
realize this may seem onerous but, it is like this so that you don't
have to couple your models tightly to a single application. Another
option is to create an application specific base model and have your app
specific models inherit from it. This would look something like this:
APP_NAMESPACE = "app_specific_namespace"
class AppSpecificBaseModel(ClassModel):
__namespace__ = APP_NAMESPACE
class MyAppModel(AppSpecificBaseModel):
foo = String
bar = String
...
...
I hope this helps.
Cheers
On 03/22/2011 01:25 AM, Dave Dodd wrote:
> Gentlefolk,
>
> I have been tasked with replacing an existing set of SOAP services and I have
> been experimenting with the using soaplib-2.0.0 beta 2 to do so via a wgsi
> handler talking to a Mongrel2 webserver. My handler is using the m2wsgi
> python library programatically and is retrieving data from MongoDB instance
> via pymongo. Not too shabby for someone without any real experience with
> python or SOAP :)
>
> I have been using soapUI to do my testing which all works as expected,
> except I am getting odd namespace prefixes in the responses generated by
> soaplib.
>
> I think I have set the namespace for my services correctly in my use of the
> soaplib.core.Application function as follows:
>
> soapapplication = soaplib.core.Application([ClientService], 'eas')
>
> The guts of a request looks like this:
>
>
> TESTACC
> 12345
>
>
> The response I get includes:
>
>
>
>
> Unknown
>
>
>
>
> Are the tns& s1 namespaces shwoing in the response correct ?
>
> I expected to see the eas namespace I had specified in the call to
> soaplib.core.Application().
>
> I have attahced the script I am using.
>
> -- Dave
>
>
> _______________________________________________
> Soap mailing list
> Soap at python.org
> http://mail.python.org/mailman/listinfo/soap
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From dave at ci.com.au Tue Mar 22 23:18:45 2011
From: dave at ci.com.au (Dave Dodd)
Date: Wed, 23 Mar 2011 09:18:45 +1100
Subject: [Soap-Python] soaplib-2.0.0-beta2 namespace problems in
responses
In-Reply-To: <4D88D591.30503@sydneysys.com>
References: <20110322062535.GD13183@mippet.ci.com.au>
<4D88D591.30503@sydneysys.com>
Message-ID: <20110322221845.GA58513@mippet.ci.com.au>
Thanks for the confirmation and very helpful explanation. I have implemented
Chris' suggestion and all now appears as it should.
Thanks & Best regards,
--Dave
From j.fine at open.ac.uk Fri Mar 25 13:23:48 2011
From: j.fine at open.ac.uk (J.Fine)
Date: Fri, 25 Mar 2011 12:23:48 +0000
Subject: [Soap-Python] Why the 'self' parameter in soap decorated methods?
Message-ID:
Hi
On the page http://soaplib.github.com/soaplib/2_0/pages/helloworld.html I read
class HelloWorldService(DefinitionBase):
@soap(String,Integer,_returns=Array(String))
def say_hello(self,name,times):
results = []
for i in range(0,times):
results.append('Hello, %s'%name)
return results
What's the purpose of the 'self' in the say_hello method. Are there any examples of it being used?
(I should add that I'm an experienced Python programmer, and know the purpose of self, and for that matter the staticmethod decorator.)
Best regards
Jonathan
--
The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).
From chris at sydneysys.com Fri Mar 25 16:05:54 2011
From: chris at sydneysys.com (Chris Austin)
Date: Fri, 25 Mar 2011 10:05:54 -0500
Subject: [Soap-Python] soaplib beta2 released
Message-ID: <4D8CAF52.1060502@sydneysys.com>
I'd like to belatedly announce the the release of soaplib beta-2.
The highlights of this second beta release are:
*Code clean-up
*Improved test coverage (this is still an area where some work is needed)
*Introduced the ClassModelConverter utility which allows simple
exporting of ClassModel instaces to xml and etree elements.
My goal is that this is the last beta for 2.0 and that we go final by
April 15th. Conceivable, 2.0 can ship sooner but I want to fill in the
obvious holes in the project documentation.
Cheers
Chris Austin
From chris at sydneysys.com Fri Mar 25 16:15:03 2011
From: chris at sydneysys.com (Chris Austin)
Date: Fri, 25 Mar 2011 10:15:03 -0500
Subject: [Soap-Python] Why the 'self' parameter in soap decorated
methods?
In-Reply-To:
References:
Message-ID:
Hi Jonathan,
Self is in the method signature for say_hello because it is an
instance method of HelloWorldService. The soap decorator does not
coerce the say_hello method into a static or class method. Nor does
the other web-method decorators (@rpc & @document).
Hope this helps.
On Fri, Mar 25, 2011 at 7:23 AM, J.Fine wrote:
> Hi
>
> On the page http://soaplib.github.com/soaplib/2_0/pages/helloworld.html I read
>
> class HelloWorldService(DefinitionBase):
> ? ?@soap(String,Integer,_returns=Array(String))
> ? ?def say_hello(self,name,times):
> ? ? ? ?results = []
> ? ? ? ?for i in range(0,times):
> ? ? ? ? ? ?results.append('Hello, %s'%name)
> ? ? ? ?return results
>
>
> What's the purpose of the 'self' in the say_hello method. ?Are there any examples of it being used?
>
> (I should add that I'm an experienced Python programmer, and know the purpose of self, and for that matter the staticmethod decorator.)
>
> Best regards
>
>
> Jonathan
>
> --
> The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).
>
> _______________________________________________
> Soap mailing list
> Soap at python.org
> http://mail.python.org/mailman/listinfo/soap
>
From j.fine at open.ac.uk Fri Mar 25 16:22:01 2011
From: j.fine at open.ac.uk (J.Fine)
Date: Fri, 25 Mar 2011 15:22:01 +0000
Subject: [Soap-Python] Why the 'self' parameter in soap decorated
methods?
In-Reply-To:
References:
Message-ID:
Thanks, Chris, for your answer. However, it doesn't tell me why make it instance rather than static.
Are there any circumstances in which it would be sensible for say_hello or some similar method to use the self argument?
Jonathan
> -----Original Message-----
> From: Chris Austin [mailto:chris at sydneysys.com]
> Sent: 25 March 2011 15:15
> To: J.Fine
> Cc: soap at python.org
> Subject: Re: [Soap-Python] Why the 'self' parameter in soap
> decorated methods?
>
> Hi Jonathan,
>
> Self is in the method signature for say_hello because it is
> an instance method of HelloWorldService. The soap decorator
> does not coerce the say_hello method into a static or class
> method. Nor does the other web-method decorators (@rpc & @document).
>
> Hope this helps.
>
> On Fri, Mar 25, 2011 at 7:23 AM, J.Fine wrote:
> > Hi
> >
> > On the page
> > http://soaplib.github.com/soaplib/2_0/pages/helloworld.html I read
> >
> > class HelloWorldService(DefinitionBase):
> > @soap(String,Integer,_returns=Array(String))
> > def say_hello(self,name,times):
> > results = []
> > for i in range(0,times):
> > results.append('Hello, %s'%name)
> > return results
> >
> >
> > What's the purpose of the 'self' in the say_hello method.
> Are there any examples of it being used?
> >
> > (I should add that I'm an experienced Python programmer,
> and know the
> > purpose of self, and for that matter the staticmethod decorator.)
> >
> > Best regards
> >
> >
> > Jonathan
> >
> > --
> > The Open University is incorporated by Royal Charter (RC
> 000391), an exempt charity in England & Wales and a charity
> registered in Scotland (SC 038302).
> >
> > _______________________________________________
> > Soap mailing list
> > Soap at python.org
> > http://mail.python.org/mailman/listinfo/soap
> >
>
From chris at sydneysys.com Fri Mar 25 16:41:01 2011
From: chris at sydneysys.com (Chris Austin)
Date: Fri, 25 Mar 2011 10:41:01 -0500
Subject: [Soap-Python] Why the 'self' parameter in soap decorated
methods?
In-Reply-To:
References:
Message-ID:
There are many circumstances where instance methods make sense.
For example, a common use case that I have is to use domain-specific
descendants of DefinitionBase as a mix-in with business objects. It
is much simpler in this case to access the instance attributes.
Personally, I don't see how forcing these methods to be static or
class based would improve or simplify things. What do you have in
mind? Do you think there could be a cleaner way do it while
maintaining a simple soap API?
On Fri, Mar 25, 2011 at 10:22 AM, J.Fine wrote:
> Thanks, Chris, for your answer. ?However, it doesn't tell me why make it instance rather than static.
>
> Are there any circumstances in which it would be sensible for say_hello or some similar method to use the self argument?
>
>
> Jonathan
>
>> -----Original Message-----
>> From: Chris Austin [mailto:chris at sydneysys.com]
>> Sent: 25 March 2011 15:15
>> To: J.Fine
>> Cc: soap at python.org
>> Subject: Re: [Soap-Python] Why the 'self' parameter in soap
>> decorated methods?
>>
>> Hi Jonathan,
>>
>> Self is in the method signature for say_hello because it is
>> an instance method of ?HelloWorldService. ?The soap decorator
>> does not coerce the say_hello method into a static or class
>> method. Nor does the other web-method decorators (@rpc & @document).
>>
>> Hope this helps.
>>
>> On Fri, Mar 25, 2011 at 7:23 AM, J.Fine wrote:
>> > Hi
>> >
>> > On the page
>> > http://soaplib.github.com/soaplib/2_0/pages/helloworld.html I read
>> >
>> > class HelloWorldService(DefinitionBase):
>> > ? ?@soap(String,Integer,_returns=Array(String))
>> > ? ?def say_hello(self,name,times):
>> > ? ? ? ?results = []
>> > ? ? ? ?for i in range(0,times):
>> > ? ? ? ? ? ?results.append('Hello, %s'%name)
>> > ? ? ? ?return results
>> >
>> >
>> > What's the purpose of the 'self' in the say_hello method.
>> Are there any examples of it being used?
>> >
>> > (I should add that I'm an experienced Python programmer,
>> and know the
>> > purpose of self, and for that matter the staticmethod decorator.)
>> >
>> > Best regards
>> >
>> >
>> > Jonathan
>> >
>> > --
>> > The Open University is incorporated by Royal Charter (RC
>> 000391), an exempt charity in England & Wales and a charity
>> registered in Scotland (SC 038302).
>> >
>> > _______________________________________________
>> > Soap mailing list
>> > Soap at python.org
>> > http://mail.python.org/mailman/listinfo/soap
>> >
>>
>
From j.fine at open.ac.uk Fri Mar 25 16:47:43 2011
From: j.fine at open.ac.uk (J.Fine)
Date: Fri, 25 Mar 2011 15:47:43 +0000
Subject: [Soap-Python] Why do I get Exception: __main__.Tiny.doit overwrites
__main__.Tiny.doit ?
Message-ID:
Hi
I was surprised to get an exception from this piece of code.
$ cat examples/method_names.py
from soaplib.service import rpc, DefinitionBase
from soaplib.serializers.primitive import String
from soaplib.wsgi import Application
def doit(self):
return 'this is a string'
class Tiny(DefinitionBase):
# Unpack the rpc decorator.
wibble = rpc(_returns=String)(doit)
wobble = rpc(_returns=String)(doit)
application = Application([Tiny], 'namespace')
And I was surprised by the exception I got. How does soaplib know that my function was called doit? And should it know?
$ python examples/method_names.py
Traceback (most recent call last):
File "examples/method_names.py", line 15, in
application = Application([Tiny], 'namespace')
File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/wsgi.py", line 89, in __init__
self.build_schema()
File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/wsgi.py", line 174, in build_schema
o.__module__, o.__name__, method.name))
Exception: __main__.Tiny.doit overwrites __main__.Tiny.doit
BTW, Tiny has attributes wibble and wobble (which I do expect). I was expecting my SOAP service to have wibble and wobble methods, but perhaps it has a doit.
Jonathan
--
The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).
From chris at sydneysys.com Fri Mar 25 18:02:31 2011
From: chris at sydneysys.com (Chris Austin)
Date: Fri, 25 Mar 2011 12:02:31 -0500
Subject: [Soap-Python] Why do I get Exception: __main__.Tiny.doit
overwrites __main__.Tiny.doit ?
In-Reply-To:
References:
Message-ID:
On Fri, Mar 25, 2011 at 10:47 AM, J.Fine wrote:
> Hi
>
> I was surprised to get an exception from this piece of code.
>
> $ cat examples/method_names.py
> from soaplib.service import rpc, DefinitionBase
> from soaplib.serializers.primitive import String
> from soaplib.wsgi import Application
>
> def doit(self):
> ? ?return 'this is a string'
>
>
> class Tiny(DefinitionBase):
>
> ? ?# Unpack the rpc decorator.
> ? ?wibble = rpc(_returns=String)(doit)
> ? ?wobble = rpc(_returns=String)(doit)
>
> application = Application([Tiny], ?'namespace')
>
>
> And I was surprised by the exception I got. ?How does soaplib know that my function was called doit? ?And should it know?
>
This is how soaplib works. Soaplib introspects the methods decorated
with @soap, @rpc or, @document. It crams these web-methods into a
public_methods dictionary. Also, it uses the meta-data attached to
the methods via the decorators to generate XML Schemata and the WSDL.
The same process creates the bindings that allow a service to pass a
soap request to correct web-method and return a soap response.
> BTW, Tiny has attributes wibble and wobble (which I do expect). ?I was expecting my SOAP service to have wibble and wobble methods, but perhaps it has a doit.
>
You are correct, it has doit().
If you need to override your methods you could try something like this:
class Tiny(DefinitionBase):
def do_it(self):
return "this is a string"
@rpc(_returns=String)
def wibble(self):
return self.do_it()
@rpc(_returns=String)
def wobble(self):
return self.do_it()
Your use case certainly is logical and one that I would like soaplib
to support in the near-future. I'll add it to the wish list for a
future release.
Cheers
Chris
>
> Jonathan
>
> --
> The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).
>
> _______________________________________________
> Soap mailing list
> Soap at python.org
> http://mail.python.org/mailman/listinfo/soap
>
From raphael.barrois at polyconseil.fr Fri Mar 25 16:27:58 2011
From: raphael.barrois at polyconseil.fr (=?iso-8859-1?Q?Rapha=EBl_Barrois?=)
Date: Fri, 25 Mar 2011 16:27:58 +0100
Subject: [Soap-Python] Why the 'self' parameter in soap decorated
methods?
In-Reply-To:
References:
Message-ID:
On 25 mars 2011, at 16:22, J.Fine wrote:
> Thanks, Chris, for your answer. However, it doesn't tell me why make it instance rather than static.
>
> Are there any circumstances in which it would be sensible for say_hello or some similar method to use the self argument?
>
>
> Jonathan
>
It could be useful if you wish to define some custom methods in your class instance (for example checks which are used for many methods)
--
Rapha?l Barrois
>> -----Original Message-----
>> From: Chris Austin [mailto:chris at sydneysys.com]
>> Sent: 25 March 2011 15:15
>> To: J.Fine
>> Cc: soap at python.org
>> Subject: Re: [Soap-Python] Why the 'self' parameter in soap
>> decorated methods?
>>
>> Hi Jonathan,
>>
>> Self is in the method signature for say_hello because it is
>> an instance method of HelloWorldService. The soap decorator
>> does not coerce the say_hello method into a static or class
>> method. Nor does the other web-method decorators (@rpc & @document).
>>
>> Hope this helps.
>>
>> On Fri, Mar 25, 2011 at 7:23 AM, J.Fine wrote:
>>> Hi
>>>
>>> On the page
>>> http://soaplib.github.com/soaplib/2_0/pages/helloworld.html I read
>>>
>>> class HelloWorldService(DefinitionBase):
>>> @soap(String,Integer,_returns=Array(String))
>>> def say_hello(self,name,times):
>>> results = []
>>> for i in range(0,times):
>>> results.append('Hello, %s'%name)
>>> return results
>>>
>>>
>>> What's the purpose of the 'self' in the say_hello method.
>> Are there any examples of it being used?
>>>
>>> (I should add that I'm an experienced Python programmer,
>> and know the
>>> purpose of self, and for that matter the staticmethod decorator.)
>>>
>>> Best regards
>>>
>>>
>>> Jonathan
>>>
>>> --
>>> The Open University is incorporated by Royal Charter (RC
>> 000391), an exempt charity in England & Wales and a charity
>> registered in Scotland (SC 038302).
>>>
>>> _______________________________________________
>>> Soap mailing list
>>> Soap at python.org
>>> http://mail.python.org/mailman/listinfo/soap
>>>
>>
> _______________________________________________
> Soap mailing list
> Soap at python.org
> http://mail.python.org/mailman/listinfo/soap
From raphael.barrois at polyconseil.fr Fri Mar 25 16:39:34 2011
From: raphael.barrois at polyconseil.fr (=?iso-8859-1?Q?Rapha=EBl_Barrois?=)
Date: Fri, 25 Mar 2011 16:39:34 +0100
Subject: [Soap-Python] [Patch] Improve soaplib to expose properly multiple
services
Message-ID: <1AA20EEF-4507-4F53-8B73-A9055E091B3D@polyconseil.fr>
Hi,
I have found a minor issue with soaplib, which doesn't handle properly the definition of an Application with multiple Services
If I define a soap Application with three services (DefinitionBase) :
class Service1(DefinitionBase):
@soap(String, _returns=String)
def my_method(self, hello):
return 'world'
class Service2(DefinitionBase):
@soap(String, _returns=String)
def my_other_method(self, guten):
return 'tag'
class Service3(DefinitionBase):
@soap(String, _returns=String)
def my_last_method(self, bonjour):
return 'monde'
app = soaplib.core.Application([Service1, Service2, Service3], 'tns', name='ExampleService')
The WSDL will only contain one entry :
I have attached a patch which fixes this issue ; let me know if I need to improve it one way or the other.
--
Rapha?l Barrois
-------------- next part --------------
A non-text attachment was scrubbed...
Name: soaplib_multiple_services.patch
Type: application/octet-stream
Size: 1539 bytes
Desc: not available
URL:
From j.fine at open.ac.uk Fri Mar 25 18:32:59 2011
From: j.fine at open.ac.uk (J.Fine)
Date: Fri, 25 Mar 2011 17:32:59 +0000
Subject: [Soap-Python] Why do I get Exception: __main__.Tiny.doit
overwrites __main__.Tiny.doit ?
In-Reply-To:
References:
Message-ID:
> From: Chris Austin
> Sent: 25 March 2011 17:03
> On Fri, Mar 25, 2011 at 10:47 AM, J.Fine wrote:
> > Hi
> >
> > I was surprised to get an exception from this piece of code.
> >
> > $ cat examples/method_names.py
> > from soaplib.service import rpc, DefinitionBase from
> > soaplib.serializers.primitive import String from
> soaplib.wsgi import
> > Application
> >
> > def doit(self):
> > return 'this is a string'
> >
> >
> > class Tiny(DefinitionBase):
> >
> > # Unpack the rpc decorator.
> > wibble = rpc(_returns=String)(doit)
> > wobble = rpc(_returns=String)(doit)
> >
> > application = Application([Tiny], 'namespace')
> >
> >
> > And I was surprised by the exception I got. How does
> soaplib know that my function was called doit? And should it know?
> >
>
> This is how soaplib works. Soaplib introspects the methods
> decorated with @soap, @rpc or, @document. It crams these
> web-methods into a public_methods dictionary.
Yes, but this does not explain why 'doit' is used (twice) as the key in the public_methods dictionary, rather than 'wibble' and 'wobble'. Reading the code for Tiny I'd be expecting to get two web-methods (wibble and wobble) and not doit and an exception.
--
Jonathan
--
The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).
From chris at sydneysys.com Fri Mar 25 20:34:38 2011
From: chris at sydneysys.com (Chris Austin)
Date: Fri, 25 Mar 2011 14:34:38 -0500
Subject: [Soap-Python] [Patch] Improve soaplib to expose properly
multiple services
In-Reply-To: <1AA20EEF-4507-4F53-8B73-A9055E091B3D@polyconseil.fr>
References: <1AA20EEF-4507-4F53-8B73-A9055E091B3D@polyconseil.fr>
Message-ID:
Hi Rapha?l,
Thank you very much for the patch. It is possible for you to submit
a pull request via github. Either way I am happy, but we've been
using the github workflow for sometime now and I liked to stick with
it if possible. Either way, I'll test and apply the patch shortly.
Thanks Again
Chris
2011/3/25 Rapha?l Barrois :
> Hi,
>
> I have found a minor issue with soaplib, which doesn't handle properly the definition of an Application with multiple Services
>
> If I define a soap Application with three services (DefinitionBase) :
>
>
>
> class Service1(DefinitionBase):
> ? ?@soap(String, _returns=String)
> ? ?def my_method(self, hello):
> ? ? ? ?return 'world'
>
> class Service2(DefinitionBase):
> ? ?@soap(String, _returns=String)
> ? ?def my_other_method(self, guten):
> ? ? ? ?return 'tag'
>
> class Service3(DefinitionBase):
> ? ?@soap(String, _returns=String)
> ? ?def my_last_method(self, bonjour):
> ? ? ? ?return 'monde'
>
> app = soaplib.core.Application([Service1, Service2, Service3], 'tns', name='ExampleService')
>
>
> The WSDL will only contain one entry :
>
> ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ?
>
>
> I have attached a patch which fixes this issue ; let me know if I need to improve it one way or the other.
>
> ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ?
> ? ?
> ? ? ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ?
> ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ?
> ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ?
> ? ?
> ? ? ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ?
> ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ?
> ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ?
> ? ?
> ? ? ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ? ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ?
> ? ?
> ? ? ? ?
> ? ? ? ? ? ?
> ? ? ? ?
> ? ?
>
> --
> Rapha?l Barrois
>
>
> _______________________________________________
> Soap mailing list
> Soap at python.org
> http://mail.python.org/mailman/listinfo/soap
>
>
From j.fine at open.ac.uk Tue Mar 29 13:59:34 2011
From: j.fine at open.ac.uk (J.Fine)
Date: Tue, 29 Mar 2011 12:59:34 +0100
Subject: [Soap-Python] Exception: ServiceName has parameter numbers
mismatching
Message-ID:
Hi
I wrote some code that seemed to me to be just fine and I got an exception from soaplib. Just in case you're worried about the code, think about a situation where the input signature is quite complicated and is stored in another file, and all you want to do is write a stub function that returns a fixed value, or a range of fixed values. In this situation you might want to try different input schemes but for the stub return a fixed value.
The background to this is that I want to decouple the various aspects of the information that goes into soaplib so that I have more flexibility. I've had a look at the source that raises this error.
https://github.com/soaplib/soaplib/blob/1_0/src/soaplib/service.py#L64
Here's the example.
$ cat examples/woozle.py
from soaplib.service import rpc, DefinitionBase
from soaplib.serializers.primitive import String
from soaplib.wsgi import Application
class Tiny(DefinitionBase):
@rpc(String, _returns=String)
def doit(self, *argv):
return 'this is a string'
application = Application([Tiny], 'namespace')
$ python examples/woozle.py
Traceback (most recent call last):
File "examples/woozle.py", line 13, in
application = Application([Tiny], 'namespace')
File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/wsgi.py", line 89, in __init__
self.build_schema()
File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/wsgi.py", line 165, in build_schema
inst = self.get_service(s)
File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/wsgi.py", line 205, in get_service
return service(http_req_env)
File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/service.py", line 260, in __init__
_public_methods_cache[cls] = self.build_public_methods()
File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/service.py", line 337, in build_public_methods
descriptor = func(_method_descriptor=True, clazz=self.__class__)
File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/service.py", line 124, in explain_method
in_message = get_input_message(ns)
File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/service.py", line 66, in get_input_message
f.func_name)
Exception: doit has parameter numbers mismatching
--
Jonathan
--
The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).
From chris at sydneysys.com Wed Mar 30 18:15:29 2011
From: chris at sydneysys.com (Chris Austin)
Date: Wed, 30 Mar 2011 11:15:29 -0500
Subject: [Soap-Python] Exception: ServiceName has parameter numbers
mismatching
In-Reply-To:
References:
Message-ID:
Hi Jonathan,
I wouldn't mind adding support for this input scheme. However, I am
afraid that it will be some time before it can be addressed. Also, I
prefer not include this in the 2.0 final that I am attempting to ship
in the next few weeks. In the meantime, if you'd like to help with
the effort to implement this I'd welcome your contribution.
Again, I am sorry that I can't support your use case right now but.
I've created the ticket here:
https://github.com/soaplib/soaplib/issues#issue/17 . Please take a
look at it and comment as you find necessary. I want to make sure
that I am capturing your idea correctly.
On Tue, Mar 29, 2011 at 6:59 AM, J.Fine wrote:
> Hi
>
> I wrote some code that seemed to me to be just fine and I got an exception from soaplib. ?Just in case you're worried about the code, think about a situation where the input signature is quite complicated and is stored in another file, and all you want to do is write a stub function that returns a fixed value, or a range of fixed values. ?In this situation you might want to try different input schemes but for the stub return a fixed value.
>
> The background to this is that I want to decouple the various aspects of the information that goes into soaplib so that I have more flexibility. ?I've had a look at the source that raises this error.
> ? ?https://github.com/soaplib/soaplib/blob/1_0/src/soaplib/service.py#L64
>
>
> Here's the example.
>
> $ cat examples/woozle.py
> from soaplib.service import rpc, DefinitionBase
> from soaplib.serializers.primitive import String
> from soaplib.wsgi import Application
>
>
> class Tiny(DefinitionBase):
>
> ? ?@rpc(String, _returns=String)
> ? ?def doit(self, *argv):
> ? ? ? ?return 'this is a string'
>
>
> application = Application([Tiny], ?'namespace')
>
>
> $ python examples/woozle.py
> Traceback (most recent call last):
> ?File "examples/woozle.py", line 13, in
> ? ?application = Application([Tiny], ?'namespace')
> ?File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/wsgi.py", line 89, in __init__
> ? ?self.build_schema()
> ?File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/wsgi.py", line 165, in build_schema
> ? ?inst = self.get_service(s)
> ?File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/wsgi.py", line 205, in get_service
> ? ?return service(http_req_env)
> ?File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/service.py", line 260, in __init__
> ? ?_public_methods_cache[cls] = self.build_public_methods()
> ?File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/service.py", line 337, in build_public_methods
> ? ?descriptor = func(_method_descriptor=True, clazz=self.__class__)
> ?File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/service.py", line 124, in explain_method
> ? ?in_message = get_input_message(ns)
> ?File "/usr/local/lib/python2.6/dist-packages/soaplib-1.0.0_beta8-py2.6.egg/soaplib/service.py", line 66, in get_input_message
> ? ?f.func_name)
> Exception: doit has parameter numbers mismatching
>
>
> --
> Jonathan
>
>
>
> --
> The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).
>
> _______________________________________________
> Soap mailing list
> Soap at python.org
> http://mail.python.org/mailman/listinfo/soap
>
From chris at sydneysys.com Wed Mar 30 18:40:53 2011
From: chris at sydneysys.com (Chris Austin)
Date: Wed, 30 Mar 2011 11:40:53 -0500
Subject: [Soap-Python] Possible change to default WSDL generation
fuctionality.
Message-ID:
Hi All,
Recently Rapha?l Barrois pointed out and submitted a fix for a bug in
the wsdl generation. This bug happens when multiple services are
passed to the soaplib Application. What is happening is that all of
the services are being assigned to the same service and portType.
See Rapha?l's message here:
http://mail.python.org/pipermail/soap/2011-March/000432.html
This has come up previously in some discussions on-list with Tres
Seaver. However, I had chose not to address it directly because any
change to the default behavior **will** break the interface(WSDL) you
have with any current consumers of your web services.
Instead, I added some attributes to DefinitionBase as well as a
parameter to @soap(...) to allow you all to declare explicitly which
Service and PortType your DefinitonBase classes and their web methods
belong in the wsdl. Nevertheless, I haven't done a particularly good
job at promoting or documenting this other than through tests in the
repo.
I'd like to get some user feedback on how I should approach this behavior.
A) Apply Rapha?l's patch and by default all DefinitionBase classes
will hint to the the wsdl generator that a new service should be
created using the classes name by default.
B) Leave the default behavior in place.
I plan to improve the documentation to show a clear example of using
the service and portType attributes regardless of the approach.
Please reply to this on-list if you have an opinion in the matter.