From yasorrat at gmail.com Thu Mar 1 08:54:29 2012 From: yasorrat at gmail.com (Fedor Stepanov) Date: Thu, 1 Mar 2012 10:54:29 +0300 Subject: [Soap-Python] rpclib and mod_wsgi Message-ID: Hello I'm trying deploy rpclib application via apache mod_wsgi. Tested service by suds app, but didn't get response from service. handler.wsgi: http://pastebin.com/Yf3eve8d Service debug output: http://pastebin.com/angUhsyC Before this in development I used wsgi server from standart python lib and got output from service on start: http://pastebin.com/8Z1NfPDE btw, I used the same suds client but with different wsdl strings. From azurit at pobox.sk Thu Mar 1 11:37:47 2012 From: azurit at pobox.sk (azurIt) Date: Thu, 01 Mar 2012 11:37:47 +0100 Subject: [Soap-Python] rpclib and mod_wsgi In-Reply-To: References: Message-ID: <20120301113747.C3F78E31@pobox.sk> Hi, don't know what exactly you are doing wrong but my WSGI file looks very different (and is working fine): http://pastebin.com/VP13wBqk azur ______________________________________________________________ > Od: "Fedor Stepanov" > Komu: > D?tum: 01.03.2012 08:54 > Predmet: [Soap-Python] rpclib and mod_wsgi > >Hello >I'm trying deploy rpclib application via apache mod_wsgi. >Tested service by suds app, but didn't get response from service. >handler.wsgi: http://pastebin.com/Yf3eve8d >Service debug output: http://pastebin.com/angUhsyC >Before this in development I used wsgi server from standart python lib >and got output from service on start: http://pastebin.com/8Z1NfPDE >btw, I used the same suds client but with different wsdl strings. >_______________________________________________ >Soap mailing list >Soap at python.org >http://mail.python.org/mailman/listinfo/soap > From rj-soaplib at sysgroup.fr Thu Mar 1 15:51:11 2012 From: rj-soaplib at sysgroup.fr (Remi Jolin) Date: Thu, 01 Mar 2012 15:51:11 +0100 Subject: [Soap-Python] rpclib Date issue Message-ID: <4F4F8CDF.1060400@sysgroup.fr> Hello, I think there is a bug in the rpclib.model.primitive.Date class : from_string result should be datetime.date(int(fields['year']), int(fields['month']), int(fields['day'])) (missing int() for all params) From burak.arslan at arskom.com.tr Fri Mar 2 17:28:58 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Fri, 02 Mar 2012 18:28:58 +0200 Subject: [Soap-Python] rpclib Date issue In-Reply-To: <4F4F8CDF.1060400@sysgroup.fr> References: <4F4F8CDF.1060400@sysgroup.fr> Message-ID: <4F50F54A.80203@arskom.com.tr> On 03/01/12 16:51, Remi Jolin wrote: > Hello, > > I think there is a bug in the rpclib.model.primitive.Date class : > from_string result should be > > datetime.date(int(fields['year']), int(fields['month']), > int(fields['day'])) > > (missing int() for all params) the patch is in the trunk. thanks! burak > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap From kmurphy at mypublisher.com Thu Mar 8 16:19:27 2012 From: kmurphy at mypublisher.com (Kevin Murphy) Date: Thu, 8 Mar 2012 15:19:27 +0000 Subject: [Soap-Python] rpclib and Content-Length header? Message-ID: <9A28849130E63E458AF1BA7CB17E2F3E6CD3CCDA@exchange2.mypublisher.local> Hello, I've written a SOAP service using rpclib 2.6.1-beta1 (originally with 2.5.2, same issue) and I'm noticing that the Content-Length header is never being set on the response from the application. This is causing undesirable behavior when the application is mounted with uWSGI in Apache (sometimes Apache is adding the Transfer-Encoding: chunked header), so I'm attempting to figure out how I can correct this so that the Content-Length is always being set. I noticed that protocol/soap/mime.py has code to deal with Content-Length, so to activate this I tried setting _mtom=True in my method decorator, but this led to a traceback first stating that out_object was being used before declaration in line 301 of server/wsgi.py. I adjusted it thusly: out_object = ctx.out_object if len(out_type_info) == 1: out_object = [out_object] But then I get another traceback from the next line complaining that out_object is not iterable: Traceback (most recent call last): File "/usr/local/pkg/python-2.7.2/lib/python2.7/site-packages/rpclib-2.6.1_mypub-py2.7.egg/rpclib/server/wsgi.py", line 200, in __call__ return self._verb_handlers[verb](req_env, start_response) File "/usr/local/pkg/python-2.7.2/lib/python2.7/site-packages/rpclib-2.6.1_mypub-py2.7.egg/rpclib/server/wsgi.py", line 310, in handle_rpc out_object File "/usr/local/pkg/python-2.7.2/lib/python2.7/site-packages/rpclib-2.6.1_mypub-py2.7.egg/rpclib/protocol/soap/mime.py", line 249, in apply_mtom name, typ = params[i] TypeError: 'ComplexModelMeta' object is not iterable So... basically I'm guessing that I'm in uncharted territory here and this code must not get used often. I'm not sure that the MtoM path is what I really need, I'm ultimately just trying to figure out how to get the Content-Length header set in the response message from the service. Any thoughts on this? Thanks! --Kevin -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Fri Mar 9 05:27:08 2012 From: burak.arslan at arskom.com.tr (burak.arslan at arskom.com.tr) Date: Fri, 09 Mar 2012 06:27:08 +0200 Subject: [Soap-Python] =?utf-8?q?rpclib_and_Content-Length_header=3F?= In-Reply-To: <9A28849130E63E458AF1BA7CB17E2F3E6CD3CCDA@exchange2.mypublisher.local> References: <9A28849130E63E458AF1BA7CB17E2F3E6CD3CCDA@exchange2.mypublisher.local> Message-ID: <8d143d63ffe5bf19a5f95736cf16ad69@arskom.com.tr> On 08.03.2012 17:19, Kevin Murphy wrote: > Hello, > > I've written a SOAP service using rpclib 2.6.1-beta1 (originally with > 2.5.2, same issue) and I'm noticing that the Content-Length header is > never being set on the response from the application. > > This is causing undesirable behavior when the application is mounted > with uWSGI in Apache (sometimes Apache is adding the > Transfer-Encoding: chunked header), so I'm attempting to figure out > how I can correct this so that the Content-Length is always being > set. Hi Kevin, To set the Content-Length header, you have to have the whole response in memory. And since the beginning my aim has been to have rpclib work without having the whole message in memory in order to have the ability to return HUGE responses. (see the roadmap document) So I've intentionally suppressed the Content-Length header from responses. But I never thought this would have side effects. So here's a quick patch for that: https://github.com/plq/rpclib/commit/7092617b74bd6b3a2d57fd9833336b851208a672 Does it work for you? > I noticed that protocol/soap/mime.py has code to deal with > Content-Length, so to activate this I tried setting _mtom=True in my > method decorator, > So? basically I'm guessing that I'm in uncharted territory here and > this code must not get used often. You're right, There's been a long time since I touched the mtom code. I doubt it works at all. Best, Burak From burak.arslan at arskom.com.tr Mon Mar 12 20:32:09 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 12 Mar 2012 21:32:09 +0200 Subject: [Soap-Python] rpclib-question In-Reply-To: <4F5DF347.9040009@matthias-runge.de> References: <4F5DF347.9040009@matthias-runge.de> Message-ID: <4F5E4F39.5050200@arskom.com.tr> On 03/12/12 14:59, Matthias Runge wrote: > Hi, > > > Recently, I discovered rpclib and your current work there. > > I got the version 2.7 beta from pypi. (same results from git clone) > > > Sadly, I'm experiencing an error in the django example-code: > > ViewDoesNotExist at/soap/hello_world/ > > Tried hello_world_service in module soap.views. Error was: 'function' > object has no attribute 'get_service_key' > > Could you tell me, how to workaround? i just fixed this: https://github.com/plq/rpclib/commit/a6ae81612607cefdd38539cfcb18499c5bd3296f best, burak From burak at arskom.com.tr Mon Mar 12 20:12:59 2012 From: burak at arskom.com.tr (Burak Arslan) Date: Mon, 12 Mar 2012 21:12:59 +0200 Subject: [Soap-Python] rpclib-question In-Reply-To: <4F5DF347.9040009@matthias-runge.de> References: <4F5DF347.9040009@matthias-runge.de> Message-ID: <4F5E4ABB.3060901@arskom.com.tr> On 03/12/12 14:59, Matthias Runge wrote: > Hi, > > > Recently, I discovered rpclib and your current work there. > > I got the version 2.7 beta from pypi. (same results from git clone) > > > Sadly, I'm experiencing an error in the django example-code: > > ViewDoesNotExist at/soap/hello_world/ > > Tried hello_world_service in module soap.views. Error was: 'function' > object has no attribute 'get_service_key' > > Could you tell me, how to workaround? i just fixed this: https://github.com/plq/rpclib/commit/a6ae81612607cefdd38539cfcb18499c5bd3296f best, burak From raoul.thill at gmail.com Wed Mar 7 16:48:04 2012 From: raoul.thill at gmail.com (Raoul Thill) Date: Wed, 07 Mar 2012 16:48:04 +0100 Subject: [Soap-Python] gist: 1242760 Unable to run with Django Message-ID: <1331135284.7271.8.camel@banana> Hi, based on the information in the comments section of the Gist, I am unable to run rpclib in conjunction with Django 1.4c1 and Apache mod_wsgi. The Apache server simply blocks upon the first request. When doing an strace on the processes I can see that some xsd file are generated in /tmp and after that nothing happens. No pages are served by this Apache anymore. Could you help me to track down the problem, I used in my tests the following code: from rpclib.server.django import DjangoApplication # not real import path. from rpclib.model.primitive import String, Integer from rpclib.model.complex import Iterable from rpclib.service import ServiceBase from rpclib.interface.wsdl import Wsdl11 from rpclib.protocol.soap import Soap11 from rpclib.application import Application from rpclib.decorator import rpc class HelloWorldService(ServiceBase): @rpc(String, Integer, _returns=Iterable(String)) def say_hello(ctx, name, times): for i in xrange(times): yield 'Hello, %s' % name hello_world_service = DjangoApplication(Application([HelloWorldService], 'some.tns', interface=Wsdl11(), in_protocol=Soap11(), out_protocol=Soap11() )) and replaced based on the comments: from rpclib.server.django import DjangoApplication # not real import path. by: from rpclib.server.wsgi import WsgiApplication and modified the service definition into: hello_world_service=WsgiApplication(Application([HelloWorldService], 'some.tns', interface=Wsdl11(), in_protocol=Soap11(), out_protocol=Soap11() )) Both examples are blocking my server. Thanks for your help. Raoul From burak.arslan at arskom.com.tr Tue Mar 13 20:52:29 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 13 Mar 2012 21:52:29 +0200 Subject: [Soap-Python] gist: 1242760 Unable to run with Django In-Reply-To: <1331135284.7271.8.camel@banana> References: <1331135284.7271.8.camel@banana> Message-ID: <4F5FA57D.2050002@arskom.com.tr> On 03/07/12 17:48, Raoul Thill wrote: > Hi, > > based on the information in the comments section of the Gist, I am > unable to run rpclib in conjunction with Django 1.4c1 and Apache > mod_wsgi. > > The Apache server simply blocks upon the first request. When doing an > strace on the processes I can see that some xsd file are generated > in /tmp and after that nothing happens. No pages are served by this > Apache anymore. most probably, this is your problem: http://mail.python.org/pipermail/soap/2012-January/000704.html i'd just use a reverse proxy setup instead of mod_wsgi. best, burak From azurit at pobox.sk Tue Mar 13 21:25:58 2012 From: azurit at pobox.sk (azurIt) Date: Tue, 13 Mar 2012 21:25:58 +0100 Subject: [Soap-Python] gist: 1242760 Unable to run with Django In-Reply-To: <1331135284.7271.8.camel@banana> References: <1331135284.7271.8.camel@banana> Message-ID: <20120313212558.46B703B2@pobox.sk> Hi, always use %{GLOBAL} for WSGIApplicationGroup in mod_wsgi for apps using lxml. azur ______________________________________________________________ > Od: "Raoul Thill" > Komu: > D?tum: 13.03.2012 19:10 > Predmet: [Soap-Python] gist: 1242760 Unable to run with Django > >Hi, > >based on the information in the comments section of the Gist, I am >unable to run rpclib in conjunction with Django 1.4c1 and Apache >mod_wsgi. > >The Apache server simply blocks upon the first request. When doing an >strace on the processes I can see that some xsd file are generated >in /tmp and after that nothing happens. No pages are served by this >Apache anymore. > >Could you help me to track down the problem, I used in my tests the >following code: > >from rpclib.server.django import DjangoApplication # not real import >path. >from rpclib.model.primitive import String, Integer >from rpclib.model.complex import Iterable >from rpclib.service import ServiceBase >from rpclib.interface.wsdl import Wsdl11 >from rpclib.protocol.soap import Soap11 >from rpclib.application import Application >from rpclib.decorator import rpc > >class HelloWorldService(ServiceBase): > @rpc(String, Integer, _returns=Iterable(String)) > def say_hello(ctx, name, times): > for i in xrange(times): > yield 'Hello, %s' % name > >hello_world_service = DjangoApplication(Application([HelloWorldService], > 'some.tns', > interface=Wsdl11(), > in_protocol=Soap11(), > out_protocol=Soap11() > )) > >and replaced based on the comments: > >from rpclib.server.django import DjangoApplication # not real import >path. >by: >from rpclib.server.wsgi import WsgiApplication > >and modified the service definition into: > >hello_world_service=WsgiApplication(Application([HelloWorldService], > 'some.tns', > interface=Wsdl11(), > in_protocol=Soap11(), > out_protocol=Soap11() > )) > >Both examples are blocking my server. > >Thanks for your help. >Raoul > >_______________________________________________ >Soap mailing list >Soap at python.org >http://mail.python.org/mailman/listinfo/soap > From yasorrat at gmail.com Wed Mar 14 06:27:30 2012 From: yasorrat at gmail.com (Fedor Stepanov) Date: Wed, 14 Mar 2012 08:27:30 +0300 Subject: [Soap-Python] rpclib and mod_wsgi In-Reply-To: <20120301113747.C3F78E31@pobox.sk> References: <20120301113747.C3F78E31@pobox.sk> Message-ID: The solution is adding WSGIApplicationGroup %{GLOBAL} in apache conf. Thanks again to Burak :) On 1 March 2012 14:37, azurIt wrote: > > Hi, > > don't know what exactly you are doing wrong but my WSGI file looks very different (and is working fine): > http://pastebin.com/VP13wBqk > > azur > > > ______________________________________________________________ >> Od: "Fedor Stepanov" >> Komu: >> D?tum: 01.03.2012 08:54 >> Predmet: [Soap-Python] rpclib and mod_wsgi >> >>Hello >>I'm trying deploy rpclib application via apache mod_wsgi. >>Tested service by suds app, but didn't get response from service. >>handler.wsgi: http://pastebin.com/Yf3eve8d >>Service debug output: http://pastebin.com/angUhsyC >>Before this in development I used wsgi server from standart python lib >>and got output from service on start: http://pastebin.com/8Z1NfPDE >>btw, I used the same suds client but with different wsdl strings. >>_______________________________________________ >>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 raoul.thill at gmail.com Wed Mar 14 08:44:57 2012 From: raoul.thill at gmail.com (Raoul Thill) Date: Wed, 14 Mar 2012 08:44:57 +0100 Subject: [Soap-Python] gist: 1242760 Unable to run with Django In-Reply-To: <20120313212558.46B703B2@pobox.sk> References: <1331135284.7271.8.camel@banana> <20120313212558.46B703B2@pobox.sk> Message-ID: <1331711097.1519.2.camel@banana> Hi, thanks for the update, as my message didn't appear on the list I could not send an update. After turning debugging on and learning some new techniques to work with mod_wsgi it turned out that WSGIApplicationGroup %{GLOBAL} must be enabled in conjunction with lxml and therefore also for rpclib. raoul -----Original Message----- From: azurIt To: soap at python.org Subject: Re: [Soap-Python] gist: 1242760 Unable to run with Django Date: Tue, 13 Mar 2012 21:25:58 +0100 Hi, always use %{GLOBAL} for WSGIApplicationGroup in mod_wsgi for apps using lxml. azur ______________________________________________________________ > Od: "Raoul Thill" > Komu: > D?tum: 13.03.2012 19:10 > Predmet: [Soap-Python] gist: 1242760 Unable to run with Django > >Hi, > >based on the information in the comments section of the Gist, I am >unable to run rpclib in conjunction with Django 1.4c1 and Apache >mod_wsgi. > >The Apache server simply blocks upon the first request. When doing an >strace on the processes I can see that some xsd file are generated >in /tmp and after that nothing happens. No pages are served by this >Apache anymore. > >Could you help me to track down the problem, I used in my tests the >following code: > >from rpclib.server.django import DjangoApplication # not real import >path. >from rpclib.model.primitive import String, Integer >from rpclib.model.complex import Iterable >from rpclib.service import ServiceBase >from rpclib.interface.wsdl import Wsdl11 >from rpclib.protocol.soap import Soap11 >from rpclib.application import Application >from rpclib.decorator import rpc > >class HelloWorldService(ServiceBase): > @rpc(String, Integer, _returns=Iterable(String)) > def say_hello(ctx, name, times): > for i in xrange(times): > yield 'Hello, %s' % name > >hello_world_service = DjangoApplication(Application([HelloWorldService], > 'some.tns', > interface=Wsdl11(), > in_protocol=Soap11(), > out_protocol=Soap11() > )) > >and replaced based on the comments: > >from rpclib.server.django import DjangoApplication # not real import >path. >by: >from rpclib.server.wsgi import WsgiApplication > >and modified the service definition into: > >hello_world_service=WsgiApplication(Application([HelloWorldService], > 'some.tns', > interface=Wsdl11(), > in_protocol=Soap11(), > out_protocol=Soap11() > )) > >Both examples are blocking my server. > >Thanks for your help. >Raoul > >_______________________________________________ >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 esiotrot at gmail.com Wed Mar 14 08:53:50 2012 From: esiotrot at gmail.com (Michael Wood) Date: Wed, 14 Mar 2012 09:53:50 +0200 Subject: [Soap-Python] gist: 1242760 Unable to run with Django In-Reply-To: <1331711097.1519.2.camel@banana> References: <1331135284.7271.8.camel@banana> <20120313212558.46B703B2@pobox.sk> <1331711097.1519.2.camel@banana> Message-ID: On 14 March 2012 09:44, Raoul Thill wrote: > Hi, > > thanks for the update, as my message didn't appear on the list I could > not send an update. > After turning debugging on and learning some new techniques to work with > mod_wsgi it turned out that WSGIApplicationGroup %{GLOBAL} must be > enabled in conjunction with lxml and therefore also for rpclib. That's not quite true. Using WSGIApplicationGroup %{GLOBAL} is one possible solution, but it can also cause problems. Another possible solution is to use WSGIDaemonProcess as mentioned in the article that Burak linked to. e.g.: http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading#The_mod_wsgi_Daemon_Processes > raoul > > -----Original Message----- > From: azurIt > To: soap at python.org > Subject: Re: [Soap-Python] gist: 1242760 Unable to run with Django > Date: Tue, 13 Mar 2012 21:25:58 +0100 > > Hi, > > always use %{GLOBAL} for WSGIApplicationGroup in mod_wsgi for apps using lxml. > > azur > > > > ______________________________________________________________ >> Od: "Raoul Thill" >> Komu: >> D?tum: 13.03.2012 19:10 >> Predmet: [Soap-Python] gist: 1242760 Unable to run with Django >> >>Hi, >> >>based on the information in the comments section of the Gist, I am >>unable to run rpclib in conjunction with Django 1.4c1 and Apache >>mod_wsgi. >> >>The Apache server simply blocks upon the first request. When doing an >>strace on the processes I can see that some xsd file are generated >>in /tmp and after that nothing happens. No pages are served by this >>Apache anymore. >> >>Could you help me to track down the problem, I used in my tests the >>following code: >> >>from rpclib.server.django import DjangoApplication # not real import >>path. >>from rpclib.model.primitive import String, Integer >>from rpclib.model.complex import Iterable >>from rpclib.service import ServiceBase >>from rpclib.interface.wsdl import Wsdl11 >>from rpclib.protocol.soap import Soap11 >>from rpclib.application import Application >>from rpclib.decorator import rpc >> >>class HelloWorldService(ServiceBase): >> ? ?@rpc(String, Integer, _returns=Iterable(String)) >> ? ?def say_hello(ctx, name, times): >> ? ? ? ?for i in xrange(times): >> ? ? ? ? ? ?yield 'Hello, %s' % name >> >>hello_world_service = DjangoApplication(Application([HelloWorldService], >> ? ? ? ?'some.tns', >> ? ? ? ?interface=Wsdl11(), >> ? ? ? ?in_protocol=Soap11(), >> ? ? ? ?out_protocol=Soap11() >> ? ?)) >> >>and replaced based on the comments: >> >>from rpclib.server.django import DjangoApplication # not real import >>path. >>by: >>from rpclib.server.wsgi import WsgiApplication >> >>and modified the service definition into: >> >>hello_world_service=WsgiApplication(Application([HelloWorldService], >> ? ? ? ?'some.tns', >> ? ? ? ?interface=Wsdl11(), >> ? ? ? ?in_protocol=Soap11(), >> ? ? ? ?out_protocol=Soap11() >> ? ?)) >> >>Both examples are blocking my server. >> >>Thanks for your help. >>Raoul -- Michael Wood From azurit at pobox.sk Wed Mar 14 12:11:18 2012 From: azurit at pobox.sk (azurIt) Date: Wed, 14 Mar 2012 12:11:18 +0100 Subject: [Soap-Python] gist: 1242760 Unable to run with Django In-Reply-To: References: <1331135284.7271.8.camel@banana>, <20120313212558.46B703B2@pobox.sk>, <1331711097.1519.2.camel@banana> Message-ID: <20120314121118.DAA916FD@pobox.sk> >That's not quite true. > >Using WSGIApplicationGroup %{GLOBAL} is one possible solution, but it >can also cause problems. What problems? > >Another possible solution is to use WSGIDaemonProcess as mentioned in >the article that Burak linked to. This is not true. You have to use %{GLOBAL} also when using WSGIDaemonProcess. If you are running several applications using lxml, create several WSGI processes (one per app). azur > >e.g.: > >http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading#The_mod_wsgi_Daemon_Processes > >> raoul >> >> -----Original Message----- >> From: azurIt >> To: soap at python.org >> Subject: Re: [Soap-Python] gist: 1242760 Unable to run with Django >> Date: Tue, 13 Mar 2012 21:25:58 +0100 >> >> Hi, >> >> always use %{GLOBAL} for WSGIApplicationGroup in mod_wsgi for apps using lxml. >> >> azur >> >> >> >> ______________________________________________________________ >>> Od: "Raoul Thill" >>> Komu: >>> D?tum: 13.03.2012 19:10 >>> Predmet: [Soap-Python] gist: 1242760 Unable to run with Django >>> >>>Hi, >>> >>>based on the information in the comments section of the Gist, I am >>>unable to run rpclib in conjunction with Django 1.4c1 and Apache >>>mod_wsgi. >>> >>>The Apache server simply blocks upon the first request. When doing an >>>strace on the processes I can see that some xsd file are generated >>>in /tmp and after that nothing happens. No pages are served by this >>>Apache anymore. >>> >>>Could you help me to track down the problem, I used in my tests the >>>following code: >>> >>>from rpclib.server.django import DjangoApplication # not real import >>>path. >>>from rpclib.model.primitive import String, Integer >>>from rpclib.model.complex import Iterable >>>from rpclib.service import ServiceBase >>>from rpclib.interface.wsdl import Wsdl11 >>>from rpclib.protocol.soap import Soap11 >>>from rpclib.application import Application >>>from rpclib.decorator import rpc >>> >>>class HelloWorldService(ServiceBase): >>> ? ?@rpc(String, Integer, _returns=Iterable(String)) >>> ? ?def say_hello(ctx, name, times): >>> ? ? ? ?for i in xrange(times): >>> ? ? ? ? ? ?yield 'Hello, %s' % name >>> >>>hello_world_service = DjangoApplication(Application([HelloWorldService], >>> ? ? ? ?'some.tns', >>> ? ? ? ?interface=Wsdl11(), >>> ? ? ? ?in_protocol=Soap11(), >>> ? ? ? ?out_protocol=Soap11() >>> ? ?)) >>> >>>and replaced based on the comments: >>> >>>from rpclib.server.django import DjangoApplication # not real import >>>path. >>>by: >>>from rpclib.server.wsgi import WsgiApplication >>> >>>and modified the service definition into: >>> >>>hello_world_service=WsgiApplication(Application([HelloWorldService], >>> ? ? ? ?'some.tns', >>> ? ? ? ?interface=Wsdl11(), >>> ? ? ? ?in_protocol=Soap11(), >>> ? ? ? ?out_protocol=Soap11() >>> ? ?)) >>> >>>Both examples are blocking my server. >>> >>>Thanks for your help. >>>Raoul > >-- >Michael Wood > From esiotrot at gmail.com Wed Mar 14 12:31:26 2012 From: esiotrot at gmail.com (Michael Wood) Date: Wed, 14 Mar 2012 13:31:26 +0200 Subject: [Soap-Python] gist: 1242760 Unable to run with Django In-Reply-To: <20120314121118.DAA916FD@pobox.sk> References: <1331135284.7271.8.camel@banana> <20120313212558.46B703B2@pobox.sk> <1331711097.1519.2.camel@banana> <20120314121118.DAA916FD@pobox.sk> Message-ID: On 14 March 2012 13:11, azurIt wrote: > >>That's not quite true. >> >>Using WSGIApplicationGroup %{GLOBAL} is one possible solution, but it >>can also cause problems. > > What problems? See this for example: http://stackoverflow.com/questions/3405533/problem-using-wsgiapplicationgroup-global-in-apache-configuration >>Another possible solution is to use WSGIDaemonProcess as mentioned in >>the article that Burak linked to. > > This is not true. You have to use %{GLOBAL} also when using WSGIDaemonProcess. If you are running several applications using lxml, create several WSGI processes (one per app). OK, it seems you would need WSGIApplicationGroup (but it's not clear to me that it MUST be %{GLOBAL}). -- Michael Wood From esiotrot at gmail.com Wed Mar 14 12:35:46 2012 From: esiotrot at gmail.com (Michael Wood) Date: Wed, 14 Mar 2012 13:35:46 +0200 Subject: [Soap-Python] gist: 1242760 Unable to run with Django In-Reply-To: References: <1331135284.7271.8.camel@banana> <20120313212558.46B703B2@pobox.sk> <1331711097.1519.2.camel@banana> <20120314121118.DAA916FD@pobox.sk> Message-ID: On 14 March 2012 13:31, Michael Wood wrote: > On 14 March 2012 13:11, azurIt wrote: >> >>>That's not quite true. >>> >>>Using WSGIApplicationGroup %{GLOBAL} is one possible solution, but it >>>can also cause problems. >> >> What problems? > > See this for example: > > http://stackoverflow.com/questions/3405533/problem-using-wsgiapplicationgroup-global-in-apache-configuration > >>>Another possible solution is to use WSGIDaemonProcess as mentioned in >>>the article that Burak linked to. >> >> This is not true. You have to use %{GLOBAL} also when using WSGIDaemonProcess. If you are running several applications using lxml, create several WSGI processes (one per app). > > OK, it seems you would need WSGIApplicationGroup (but it's not clear > to me that it MUST be %{GLOBAL}). It seems that %{GLOBAL} is the way to go with WSGIDaemonProcess too: http://stackoverflow.com/questions/5021424/mod-wsgi-daemon-mode-wsgiapplicationgroup-and-python-interpreter-separation So the safest option seems to use both, but you might be able to get away with only WSGIApplicationGroup %{GLOBAL} depending on the circumstances. -- Michael Wood From azurit at pobox.sk Wed Mar 14 12:51:12 2012 From: azurit at pobox.sk (azurIt) Date: Wed, 14 Mar 2012 12:51:12 +0100 Subject: [Soap-Python] gist: 1242760 Unable to run with Django In-Reply-To: References: <1331135284.7271.8.camel@banana>, <20120313212558.46B703B2@pobox.sk>, <1331711097.1519.2.camel@banana>, , <20120314121118.DAA916FD@pobox.sk> Message-ID: <20120314125112.942C768B@pobox.sk> >See this for example: > >http://stackoverflow.com/questions/3405533/problem-using-wsgiapplicationgroup-global-in-apache-configuration Hah, this is because that user don't understand how mod_wsgi works. Of course that this happened cos he used the same WSGI process and the same application group for all sites. It's his fault and it's not caused by %{GLOBAL} usage. You should: 1.) use different application group for _every_ site/application 2.) if (1) is not possible (for example, all sites needs to use lxml so all of them needs to run in %{GLOBAL}), use different wsgi process for _every_ such site/application >>>Another possible solution is to use WSGIDaemonProcess as mentioned in >>>the article that Burak linked to. >> >> This is not true. You have to use %{GLOBAL} also when using WSGIDaemonProcess. If you are running several applications using lxml, create several WSGI processes (one per app). > >OK, it seems you would need WSGIApplicationGroup (but it's not clear >to me that it MUST be %{GLOBAL}). Yes, it MUST be, trust me. azur From esiotrot at gmail.com Wed Mar 14 12:59:32 2012 From: esiotrot at gmail.com (Michael Wood) Date: Wed, 14 Mar 2012 13:59:32 +0200 Subject: [Soap-Python] gist: 1242760 Unable to run with Django In-Reply-To: <20120314125112.942C768B@pobox.sk> References: <1331135284.7271.8.camel@banana> <20120313212558.46B703B2@pobox.sk> <1331711097.1519.2.camel@banana> <20120314121118.DAA916FD@pobox.sk> <20120314125112.942C768B@pobox.sk> Message-ID: On 14 March 2012 13:51, azurIt wrote: > >>See this for example: >> >>http://stackoverflow.com/questions/3405533/problem-using-wsgiapplicationgroup-global-in-apache-configuration > > Hah, this is because that user don't understand how mod_wsgi works. Of course that this happened cos he used the same WSGI process and the same application group for all sites. It's his fault and it's not caused by %{GLOBAL} usage. You should: > 1.) use different application group for _every_ site/application > 2.) if (1) is not possible (for example, all sites needs to use lxml so all of them needs to run in %{GLOBAL}), use different wsgi process for _every_ such site/application Of course, but my point is it's not enough to tell someone "Just use WSGIApplicationGroup %{GLOBAL}" :) They might also need to use daemon processes. >>>>Another possible solution is to use WSGIDaemonProcess as mentioned in >>>>the article that Burak linked to. >>> >>> This is not true. You have to use %{GLOBAL} also when using WSGIDaemonProcess. If you are running several applications using lxml, create several WSGI processes (one per app). >> >>OK, it seems you would need WSGIApplicationGroup (but it's not clear >>to me that it MUST be %{GLOBAL}). > > Yes, it MUST be, trust me. Yes, I see now. -- Michael Wood From azurit at pobox.sk Wed Mar 14 14:13:12 2012 From: azurit at pobox.sk (azurIt) Date: Wed, 14 Mar 2012 14:13:12 +0100 Subject: [Soap-Python] gist: 1242760 Unable to run with Django In-Reply-To: References: <1331135284.7271.8.camel@banana>, <20120313212558.46B703B2@pobox.sk>, <1331711097.1519.2.camel@banana>, , <20120314121118.DAA916FD@pobox.sk>, , <20120314125112.942C768B@pobox.sk> Message-ID: <20120314141312.56643AEC@pobox.sk> >> Hah, this is because that user don't understand how mod_wsgi works. Of course that this happened cos he used the same WSGI process and the same application group for all sites. It's his fault and it's not caused by %{GLOBAL} usage. You should: >> 1.) use different application group for _every_ site/application >> 2.) if (1) is not possible (for example, all sites needs to use lxml so all of them needs to run in %{GLOBAL}), use different wsgi process for _every_ such site/application > >Of course, but my point is it's not enough to tell someone "Just use >WSGIApplicationGroup %{GLOBAL}" :) They might also need to use daemon >processes. > Well i don't see much reasons why NOT use daemon processes. It's much more flexible and faster and it's like some kind of python application server which is cool. If you are running inside apache processes, everything must be reinitialized with every reuqest. azur From ralienpp at gmail.com Fri Mar 16 19:20:29 2012 From: ralienpp at gmail.com (Alex Railean) Date: Fri, 16 Mar 2012 20:20:29 +0200 Subject: [Soap-Python] Implement a server from an existing WSDL specification Message-ID: <1284295936.20120316202029@gmail.com> Hi everyone, I am glad I discovered this list, I've read most of the conversations from the "beginning of time" up to this day and I am looking forward to interacting with you. SOAP is a new concept for me, there are questions I hope you can help with. I am not intimately familiar with the terminology, so I suspect some of the questions may be dumb. The service I am working on must comply with an existing WSDL specification: http://pastebin.com/vqVpGix1 (standardized in ETSI 102.204) My questions are: 1. what is the recommended approach for writing a SOAP server that implements an existing WSDL? 2. which of the existing frameworks a. supports basic types such as xsd:anyURI, xsd:dateTime or xsd:base64Binary? b. allows the declaration of enumerations and their possible values? c. allows the declaration of custom types for which some information is passed not as an XML element, but as an attribute? d. allows the use of custom complex types that are defined in an existing namespace? (I think this is the same as [a], but am not entirely sure about it) 3. are there any books on SOAP/XML and Python you can recommend? If there is no Python-specific literature, perhaps there are good books about SOAP/XML in general? The part below is optional :-), it describes my experiences with SOAP/XML in Python. Having studied the available tools, I chose to go with Ladon, because: - the description makes it look very simple - the syntax is straightforward and concise - it has very clear examples - documentation is generated automatically I was able to create a simple SOAP/XML server and call its functions within an hour, it worked just as advertised. Surprisingly, I only found 2 references to Ladon on this mailing list, it seems that the rest of the world is doing something completely different. Although my first experience was very positive, later I realized things may be more complicated than I anticipated. Ladon makes it easy to write services from scratch, I focus on the logic, and the WSDL is automagically generated. However, my actual objective is to take an existing WSDL and implement its rules in my own code. Since my WSDL is relatively simple, it has 7 functions (not sure if this is the proper SOAP terminology) - I figured I'd just define my classes and functions accordingly, such that the generated WSDL is identical to the reference WSDL. This is where things got tricky. While everything is easy with primitive types such as strings or numbers, the XML schema of the spec has a lot of other types in it, simple ones such as anyURI or NCName, and complex ones. These two examples I gave are still strings, but they have some constraints applied to them. If I declare them as strings, I can perform all the necessary checks myself, but the generated WSDL file doesn't look right (because "xs:string" and "xs:anyURI" are different). This is probably going to cause compatibility issues with systems that are supposed to use my service when it is released. My conclusion was that I would have to define them as custom types derived from primitive types, but.... this simply doesn't feel right, because it involves reinventing a lot of things. Then I turned to ZSI, as people say it generates code from the given WSDL - it sounded that this was the thing I needed. I was also hoping it would take care of defining all the types for me. ZSI seems pretty arcane and not very alive (even though the mailing list seems to be somewhat active) - I am not sure if it is a good choice. I hope you weren't bored to death by the account of my SOAP adventures. Alex p.s. if anyone ever visits Moldova, I'd be happy to show you around :-) From burak.arslan at arskom.com.tr Sat Mar 17 03:03:48 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Sat, 17 Mar 2012 04:03:48 +0200 Subject: [Soap-Python] Implement a server from an existing WSDL specification In-Reply-To: <1284295936.20120316202029@gmail.com> References: <1284295936.20120316202029@gmail.com> Message-ID: <4F63F104.7030502@arskom.com.tr> Hey there, So I guess you're the first person I've come to meet online or offline who actually enjoys working with soap :) Your message is huge, yet entertaining, so I've actually read it all. Top posting answers to prevent this thread from explosing in length: 1) You do it manually, from scratch. This comes up a lot, and I believe someone just will do it sometime. 2) Rpclib supports all this, and it also supports other protocols. It doesn't support NCName, but to get that you just need to: from rpclib.model.primitive import Unicode class NCName(Unicode): __type_name__='NCName' and you're set. send me a pull request if that works for you. 3) Nope. Java ecosystem has plenty of those though. Avoid ZSI, SOAPPy, SOAPpy, they're not maintained anymore. Use maintained packages like Rpclib, Ladon or PySimpleSoap for server and SUDS for client. Best Regards, Burak PS: I'm totally going to steal ladon's documentation generator :) On 03/16/12 20:20, Alex Railean wrote: > Hi everyone, > > > I am glad I discovered this list, I've read most of the conversations > from the "beginning of time" up to this day and I am looking forward > to interacting with you. > > SOAP is a new concept for me, there are questions I hope you can help > with. I am not intimately familiar with the terminology, so I suspect > some of the questions may be dumb. > > > The service I am working on must comply with an existing WSDL > specification: http://pastebin.com/vqVpGix1 (standardized in ETSI > 102.204) > > > My questions are: > 1. what is the recommended approach for writing a SOAP server that > implements an existing WSDL? > > 2. which of the existing frameworks > a. supports basic types such as xsd:anyURI, xsd:dateTime or > xsd:base64Binary? > b. allows the declaration of enumerations and their possible > values? > c. allows the declaration of custom types for which some > information is passed not as an XML element, but as an > attribute? > d. allows the use of custom complex types that are defined in an > existing namespace? (I think this is the same as [a], but am > not entirely sure about it) > > 3. are there any books on SOAP/XML and Python you can recommend? If > there is no Python-specific literature, perhaps there are good > books about SOAP/XML in general? > > > > > > > > > The part below is optional :-), it describes my experiences with > SOAP/XML in Python. > > > > Having studied the available tools, I chose to go with Ladon, because: > - the description makes it look very simple > - the syntax is straightforward and concise > - it has very clear examples > - documentation is generated automatically > > I was able to create a simple SOAP/XML server and call its functions > within an hour, it worked just as advertised. > > > Surprisingly, I only found 2 references to Ladon on this mailing list, > it seems that the rest of the world is doing something completely > different. > > > Although my first experience was very positive, later I realized > things may be more complicated than I anticipated. > > Ladon makes it easy to write services from scratch, I focus on the > logic, and the WSDL is automagically generated. > > > > However, my actual objective is to take an existing WSDL and implement > its rules in my own code. Since my WSDL is relatively simple, it has 7 > functions (not sure if this is the proper SOAP terminology) - I > figured I'd just define my classes and functions accordingly, such > that the generated WSDL is identical to the reference WSDL. > > This is where things got tricky. While everything is easy with > primitive types such as strings or numbers, the XML schema of the spec > has a lot of other types in it, simple ones such as anyURI or NCName, > and complex ones. > > These two examples I gave are still strings, but they have some > constraints applied to them. If I declare them as strings, I can > perform all the necessary checks myself, but the generated WSDL file > doesn't look right (because "xs:string" and "xs:anyURI" are > different). This is probably going to cause compatibility issues with > systems that are supposed to use my service when it is released. > > > My conclusion was that I would have to define them as custom types > derived from primitive types, but.... this simply doesn't feel right, > because it involves reinventing a lot of things. > > > > > Then I turned to ZSI, as people say it generates code from the given > WSDL - it sounded that this was the thing I needed. I was also hoping > it would take care of defining all the types for me. > > ZSI seems pretty arcane and not very alive (even though the mailing > list seems to be somewhat active) - I am not sure if it is a good > choice. > > > I hope you weren't bored to death by the account of my SOAP > adventures. > > > Alex > > > > > > p.s. if anyone ever visits Moldova, I'd be happy to show you around > :-) > > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap From ralienpp at gmail.com Mon Mar 19 14:24:25 2012 From: ralienpp at gmail.com (Alex) Date: Mon, 19 Mar 2012 15:24:25 +0200 Subject: [Soap-Python] Implement a server from an existing WSDL specification In-Reply-To: <4F63F104.7030502@arskom.com.tr> References: <1284295936.20120316202029@gmail.com> <4F63F104.7030502@arskom.com.tr> Message-ID: <62861005.20120319152425@gmail.com> Hi Burak, thanks for the swift response. I've played with rpclib over the weekend. I noticed that the documentation is lacking several chapters (ex: input validation). I'd like to contribute to that part, as I think it will be the most effective way to familiarize myself with the software. Basically, I want to extend the docs by writing examples for custom types that have: - their own validation rules - additional attributes besides the typical ones like minOccurs or nullable - a limited set of possible values (enumerations) Other questions may come to the surface in the meantime, but these are the ones I asked in the beginning of my journey and these are the ones I want to provide answers for. If things go as planned, I could also write more about implementing a WSDL by hand. These are obvious to someone who has been doing this for a while, but for someone with no prior exposure to WSDL or SOAP (such as myself) - it's not trivial. > So I guess you're the first person I've come to meet online or offline who actually enjoys working with soap :) Oh, it's not because I like SOAP, it is because I love Python - it makes everything look one-two-threasy :-) Let me begin with validation rules. Is it appropriate to discuss everything here, or should I just fork, write what I think is a reasonable intro to this matter? From burak.arslan at arskom.com.tr Mon Mar 19 14:27:09 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 19 Mar 2012 15:27:09 +0200 Subject: [Soap-Python] Implement a server from an existing WSDL specification In-Reply-To: <62861005.20120319152425@gmail.com> References: <1284295936.20120316202029@gmail.com> <4F63F104.7030502@arskom.com.tr> <62861005.20120319152425@gmail.com> Message-ID: <4F67342D.5090801@arskom.com.tr> On 03/19/12 15:24, Alex wrote: > Let me begin with validation rules. Is it appropriate to discuss > everything here, or should I just fork, write what I think is a > reasonable intro to this matter? well, i'm happy to answer any questions you might have. validation needs both more tests and docs, so there's definitely a lot to do there. you can start with small contributions. i'll review these for you quickly. later as we go along, you can increase your pace. best, burak From ralienpp at gmail.com Tue Mar 20 23:29:48 2012 From: ralienpp at gmail.com (Alex) Date: Wed, 21 Mar 2012 00:29:48 +0200 Subject: [Soap-Python] Complex types with quirks, declaring them in rpclib Message-ID: Burak, In parallel with writing the documentation for input validation in rpclib, I am trying to apply rpclib to solve the problem that brought me to this list in the first place. I began creating my custom types and I ran into some cases which don't seem to be straightforward. One of the types looks like this ds:DigestMethodType is in another namespace, the link to which is given in the beginning of the WSDL file. If I understand things correctly, I have to create a custom class for DigestMethodType and override its __namespace__ = 'ds'. Can you confirm that? (1) It is also necessary to modify the top of the generated WSDL file and include a link to the document that defines the 'ds' namespace. How to do that? I supposed I could also override the namespace with a URL to the XML file itself, but is that a good practice? DigestMethodType itself is a tricky beast, this is the definition: http://xml.fmi.fi/namespace/woml/swo/2011/11/15/index790.html (2) how does rpclib handle 'namespace="##other"'? My understanding is that it means I can add an arbitrary number of elements of any type. The closest match I could find is AnyXml or AnyDict (declared in primitive.py). However, I am not sure how to use it; test_primitive.py doesn't cover these two classes. (3) 'use="required"' - the 'use' attribute is not declared in the AnyUri class, neither in Unicode or SimpleModels (the classes from which it was derived). It seems to be a basic attribute; was I unable to find it? Or is it really not there? (4) 'mixed' is another attribute that I didn't find declared in the base class of the ComplexType class? Does one really need it? I mean, maybe it is assumed that all the ComplexType children are mixed by default? There's another data type with the poetic name 'DataType' :-) I've seen how to declare elements and attributes in a custom type, but this is something new to me. It feels like some kind of inheritance, so: (5) How to declare such a type? I will update the documentation and add some examples of this as soon as I figure it out myself. Alex From burak.arslan at arskom.com.tr Wed Mar 21 00:22:09 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 21 Mar 2012 01:22:09 +0200 Subject: [Soap-Python] Complex types with quirks, declaring them in rpclib In-Reply-To: References: Message-ID: <4F691121.20609@arskom.com.tr> On 03/21/12 00:29, Alex wrote: > Burak, > > In parallel with writing the documentation for input validation in > rpclib, I am trying to apply rpclib to solve the problem that brought > me to this list in the first place. > > I began creating my custom types and I ran into some cases which don't > seem to be straightforward. > > > > One of the types looks like this > > > > > > > > > > ds:DigestMethodType is in another namespace, the link to which is > given in the beginning of the WSDL file. If I understand things > correctly, I have to create a custom class for DigestMethodType and > override its __namespace__ = 'ds'. Can you confirm that? no, ds is just the prefix. you need to find the xmlns:ds attribute and use its value as the value of the __namespace__ attribute. Here's how the above would look like: class DigestValueType(ComplexModel): __namespace__ = "some_ns" class DigestMethodTypeComplexModel): __namespace__ = "some_ns" class DigestAlgAndValueType(ComplexModel): DigestMethod = DigestMethodType DigestValue = DigestValueType.customize(min_occurs=1) > (1) It is also necessary to modify the top of the generated WSDL file > and include a link to the document that defines the 'ds' namespace. > How to do that? I supposed I could also override the namespace with a > URL to the XML file itself, but is that a good practice? Ah. Rpclib does not support that directly. But I've just committed support for the 'document_built' event in the InterfaceBase. so if you register an event for that and make the desired changes to the generated wsdl document directly, you can do that. https://github.com/plq/rpclib/commit/f93b44ffe81ad5bc8b7441b95f58b99fa49a4e7e > > > DigestMethodType itself is a tricky beast, this is the definition: > http://xml.fmi.fi/namespace/woml/swo/2011/11/15/index790.html > > > > maxOccurs="unbounded"/> > > > > > (2) how does rpclib handle 'namespace="##other"'? My understanding is > that it means I can add an arbitrary number of elements of any type. > The closest match I could find is AnyXml or AnyDict (declared in > primitive.py). However, I am not sure how to use it; test_primitive.py > doesn't cover these two classes. Rpclib can't generate this schema, you'd have to come up with a patch to the xml schema implementation that actually emits an tag. > (3) 'use="required"' - the 'use' attribute is not declared in the > AnyUri class, neither in Unicode or SimpleModels (the classes from > which it was derived). It seems to be a basic attribute; was I unable > to find it? Or is it really not there? No, it isn't there. I actually didn't know about this. Why not just use min_occurs=1 ? > (4) 'mixed' is another attribute that I didn't find declared in the > base class of the ComplexType class? Does one really need it? I mean, > maybe it is assumed that all the ComplexType children are mixed by > default? > That isn't supported either. XML Schema specification should say the default value in case of abscence. > > There's another data type with the poetic name 'DataType' :-) > > > > > > > > > > > > I've seen how to declare elements and attributes in a custom type, but > this is something new to me. It feels like some kind of inheritance, > so: > > (5) How to declare such a type? You can't. Rpclib only supports simpleType extension via restrictions, not attributes. I guess this wasn't much of help but what can I say, patches are welcome... Best Regards, Burak From ralienpp at gmail.com Wed Mar 21 14:52:44 2012 From: ralienpp at gmail.com (Alex Railean) Date: Wed, 21 Mar 2012 15:52:44 +0200 Subject: [Soap-Python] Complex types with quirks, declaring them in rpclib In-Reply-To: <4F691121.20609@arskom.com.tr> References: <4F691121.20609@arskom.com.tr> Message-ID: <1499848696.20120321155244@gmail.com> Hi, >> (3) 'use="required"' - the 'use' attribute is not declared in the >> ... > No, it isn't there. I actually didn't know about this. Why not just use > min_occurs=1 ? I think "use" is for attributes, whereas "min_occurs" is for elements. http://www.w3.org/TR/xmlschema-0/#OccurrenceConstraints I've done some digging in complex.py and I saw that the XmlAttribute class has a describe() function that does look for a "use" argument. Is this not the solution? > class DigestAlgAndValueType(ComplexModel): > DigestMethod = DigestMethodType > DigestValue = DigestValueType.customize(min_occurs=1) The call to customize() returns an object of DigestValueType and overrides the min_occurs property with 1, right? Why not just declare DigestValueType with min_occurs=1 from the very beginning? >> >> >> >> >> >> >> >> >> > You can't. Rpclib only supports simpleType extension via restrictions, > not attributes. Ok, I will try to simplify the problem then. Since those who will use my server already have the WSDL, it is not critical for me to be able to produce a WSDL that looks exactly like the one given in the specifications. However, it is critical for me to be able to receive such a request and be able to handle it. If I create a custom type like this, will it do the trick? class DataType(ComplexModel): class Attributes(ComplexModel.Attributes): MimeType = XmlAttribute(String, use = 'optional') Encoding = XmlAttribute(String, use = 'optional') >> (2) how does rpclib handle 'namespace="##other"'? > Rpclib can't generate this schema, you'd have to come up with a patch to > the xml schema implementation that actually emits an tag. I've examined the source and this seems to be the place to tinker with: src\rpclib\interface\xml_schema\model\complex.py But besides generating such a schema, there must also be a way to represent such a structure in the custom type definition, which happens here: rpclib\src\rpclib\model\complex.py Can you confirm that this is the case? In addition to that, it would be great if you could offer some tips about implementing this. I am not yet familiar enough with the guts of rpclib to be able to make such fundamental changes. Alex From burak.arslan at arskom.com.tr Wed Mar 21 17:33:03 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 21 Mar 2012 18:33:03 +0200 Subject: [Soap-Python] Complex types with quirks, declaring them in rpclib In-Reply-To: <1499848696.20120321155244@gmail.com> References: <4F691121.20609@arskom.com.tr> <1499848696.20120321155244@gmail.com> Message-ID: <4F6A02BF.9040901@arskom.com.tr> On 03/21/12 15:52, Alex Railean wrote: > I've done some digging in complex.py and I saw that the XmlAttribute > class has a describe() function that does look for a "use" argument. > Is this not the solution? ah. indeed. It looks like I've missed this. > >> class DigestAlgAndValueType(ComplexModel): >> DigestMethod = DigestMethodType >> DigestValue = DigestValueType.customize(min_occurs=1) > The call to customize() returns an object of DigestValueType and > overrides the min_occurs property with 1, right? > > Why not just declare DigestValueType with min_occurs=1 from the very > beginning? that's possible. class DigestValueType(ComplexModel): __namespace__ = "some_ns" class Attributes(ComplexModel.Attributes): min_occurs=1 > > > > >>> >>> >>> >>> >>> >>> >>> >>> >>> >> You can't. Rpclib only supports simpleType extension via restrictions, >> not attributes. > Ok, I will try to simplify the problem then. Since those who will use > my server already have the WSDL, it is not critical for me to be able > to produce a WSDL that looks exactly like the one given in the > specifications. > > However, it is critical for me to be able to receive such a request > and be able to handle it. > > If I create a custom type like this, will it do the trick? > > class DataType(ComplexModel): > class Attributes(ComplexModel.Attributes): > MimeType = XmlAttribute(String, use = 'optional') > Encoding = XmlAttribute(String, use = 'optional') Nope. the class Attributes has nothing to do with xml attributes. It used to be, but I could not think of a way to handle elements attributes with same name. So I decided to avoid the problem and decided to have attributes and elements put in one namespace. It's still named Attributes because of backwards compatibility. It's currently just a way to store metadata. Anyway, you should do this: class DataType(ComplexModel): MimeType = XmlAttribute(String, use = 'optional') Encoding = XmlAttribute(String, use = 'optional') Here's what that generates: Which is not what you want. However, If you use no validation or soft validation, you can receive fields like this: > Rpclib can't generate this schema, you'd have to come up with a patch to >> the xml schema implementation that actually emits an tag. > I've examined the source and this seems to be the place to tinker > with: src\rpclib\interface\xml_schema\model\complex.py > > But besides generating such a schema, there must also be a way to > represent such a structure in the custom type definition, which > happens here: rpclib\src\rpclib\model\complex.py > > Can you confirm that this is the case? Yes, these are correct. > In addition to that, it would be great if you could offer some > tips about implementing this. I am not yet familiar enough with the > guts of rpclib to be able to make such fundamental changes. > That will partly depend on the kind of API you want to offer. You'll most probably implement a class similar to XmlAttribute. The metaclass in ComplexModel scans cls_dict to extract rpclib-relevant attributes and puts them in the _type_info attribute. The Xml schema implementation in the rpclib.interface package uses this information to generate the schema document. And I imagine the funky thing that'll make the code hard to follow there is cdict. It's a special kind of dict that accepts classes as keys and any data as value. It tries parent classes as keys if it can't find the given class itself. See this for more info: https://github.com/plq/rpclib/blob/f7dc3b87feaa97953eeb12a92c367f23314ac243/src/rpclib/util/cdict.py Other than that, I think it's a fairly straightforward implementation. Regardless, I'm happy to answer your questions. Best, Burak ] From ralienpp at gmail.com Wed Mar 21 23:15:33 2012 From: ralienpp at gmail.com (Alex) Date: Thu, 22 Mar 2012 00:15:33 +0200 Subject: [Soap-Python] Complex types with quirks, declaring them in rpclib In-Reply-To: <4F6A02BF.9040901@arskom.com.tr> References: <4F691121.20609@arskom.com.tr> <1499848696.20120321155244@gmail.com> <4F6A02BF.9040901@arskom.com.tr> Message-ID: Hi, I am going to try to create a basic service, after that I'll be able to understand better how the sources work. Until then I have insufficient competence to decide which of the solutions you suggested is better. My hunch is that it is better to alter the XML schema generation mechanism such that it generates the schema I want, instead of turning off validation or using soft validation (because I will lose all the checks that lxml would otherwise do for me) and parsing the string myself at a higher level. I've used XPath and I even made some screencasts about it: http://www.youtube.com/watch?v=7RiW2g-AKbs http://www.youtube.com/watch?v=PgWfF-Ut0zM I think it would be great if we could make such screencasts about rpclib, that would definitely make it more accessible to inexperienced folks such as myself. My current priority is to focus on the creation of these custom classes, but I will happily accept to work on the video tutorials or write more documentation, if someone else can help me by creating those classes (assuming that they're relatively easy to implement for someone familiar with the intimate details of rpclib). Alex From Ryan.Hsu at emc.com Fri Mar 23 22:27:00 2012 From: Ryan.Hsu at emc.com (Ryan.Hsu at emc.com) Date: Fri, 23 Mar 2012 17:27:00 -0400 Subject: [Soap-Python] What is the correct way to call this operation? Message-ID: Hi All, I am trying to call a SOAP operation from a WSDL that has multiple namespaces: The operation I am trying to call is: where LoginInfo is a complex type defined as such: However, when I attempt to call it with: client = SoapClient(wsdl='http://myserver:9443/services/mcService?wsdl', trace=True, soap_server='axis') client.login({'user': 'test', 'password': 'xxx', 'client': 'tester', 'domain': '/', 'locale': 'en_US'}) The server does not like the request: -------------------------------------------------------------------------------- POST http://10.99.99.5:9443/services/mcService.McServiceHttpSoap11Endpoint/ SOAPAction: "urn:login" Content-length: 445 Content-type: text/xml; charset="UTF-8" testxxxtester/en_US transfer-encoding: chunked status: 500 content-type: text/xml; charset=utf-8 soapenv:Serverorg.apache.axis2.databinding.ADBException: Unexpected subelement args0 ================================================================================ Am I doing something wrong here? I have a feeling it has to do with namespaces not being prefixed to the individual parameters. Any help is greatly appreciated! Thank you, Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Sat Mar 24 13:06:46 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Sat, 24 Mar 2012 14:06:46 +0200 Subject: [Soap-Python] What is the correct way to call this operation? In-Reply-To: References: Message-ID: <4F6DB8D6.9070102@arskom.com.tr> On 03/23/12 23:27, Ryan.Hsu at emc.com wrote: > > However, when I attempt to call it with: > > client = > SoapClient(wsdl='http://myserver:9443/services/mcService?wsdl', > trace=True, soap_server='axis') > > client.login({'user': 'test', 'password': 'xxx', 'client': > 'tester', 'domain': '/', 'locale': 'en_US'}) > > The server does not like the request: > > I have a feeling it has to do with namespaces not being prefixed to > the individual parameters. I agree, the cllient you're using (I don't recognize the api) is sending an invalid request. Did you try it with suds? Try this: from suds.client import Client client = Client('http://myserver:9443/services/mcService?wsdl') client.service.login('test', 'xxx', 'tester', '/', 'en_US') Hth, Burak From sssssssenator at gmail.com Tue Mar 27 07:20:30 2012 From: sssssssenator at gmail.com (vaibhav negi) Date: Tue, 27 Mar 2012 10:50:30 +0530 Subject: [Soap-Python] soap rpc in zope 3 Message-ID: Hi, I am trying to write soap rpc apis in zope 3 project. I am able to serve soap requests reading the example provided in rpclib documentation but that runs on independent wsgi server. i want to serve soap requests from zope 3 server. any clue? Regards Vaibhav Negi From dieter at handshake.de Tue Mar 27 18:34:08 2012 From: dieter at handshake.de (Dieter Maurer) Date: Tue, 27 Mar 2012 18:34:08 +0200 Subject: [Soap-Python] soap rpc in zope 3 In-Reply-To: References: Message-ID: <20337.60416.649308.262332@localhost.localdomain> vaibhav negi wrote at 2012-3-27 10:50 +0530: >I am trying to write soap rpc apis in zope 3 project. I am able to >serve soap requests reading the example provided in rpclib >documentation but that runs on independent wsgi server. i want to >serve soap requests from zope 3 server. any clue? You might have a look at "dm.zope.rpc.wsdl_suds". It does something like this for Zope 2, using suds for SOAP demarshaling/marshaling. The Zope 3 way would be to register a SOAP view (rather then a browser view) and do their demarshaling, call the function and marshal the result. -- Dieter From ralienpp at gmail.com Thu Mar 29 18:32:24 2012 From: ralienpp at gmail.com (Alex Railean) Date: Thu, 29 Mar 2012 19:32:24 +0300 Subject: [Soap-Python] Customizing rpclib with types that modify the schema Message-ID: <359299370.20120329193224@gmail.com> Hi everyone, I wish to extend rpclib with the possibility of generating a schema with an "any" tag: I also want to document the process, so others will have a clue about it. What I think I have to do: 1. add a new class to the list of primitives 2. change the code that produces XML from a Python class 3. change the code that generates a Python object from XML 4. extend the tests, such that they include the newly created type My questions are: a. are there any other steps that I missed? b. which class should I inherit from? - AnyXml and AnyDict seem reasonable candidates, their names are very attractive. However, I did not find any examples of how they are used - if my guess is correct, then this will be a simple matter of creating a derived class and setting __namespace__ to '##other'. This sounds too good to be true. c. what are the functions that have to be overridden in the new class? d. how to tell the parser about "processContents", "namespace" and the behaviour specified by its different values? - I think it can rely on validate_native, but my understanding is that I must also define the behaviour of validate_native for this type - I don't know where to do that e. is there any documentation about this? Some kind of howto? f. which other questions was I supposed to ask? :-) Looking forward to your feedback. From burak.arslan at arskom.com.tr Fri Mar 30 00:57:53 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Fri, 30 Mar 2012 01:57:53 +0300 Subject: [Soap-Python] Customizing rpclib with types that modify the schema In-Reply-To: <359299370.20120329193224@gmail.com> References: <359299370.20120329193224@gmail.com> Message-ID: <4F74E8F1.8030306@arskom.com.tr> Hi, I thought if I'd just start implementing this, it'd help you more than a 300-word reply. I skimmed the spec very quick and from what I gather, you want an tag instead of an tag inside the (...) hierarchy, right? (correct me if i'm wrong here.) if so, here's the patch that is a nice starting point: diff --git a/src/rpclib/interface/xml_schema/model/complex.py b/src/rpclib/interface/xml_schema/model/complex.py index f99f587..ae0d65c 100644 --- a/src/rpclib/interface/xml_schema/model/complex.py +++ b/src/rpclib/interface/xml_schema/model/complex.py @@ -22,6 +22,7 @@ from lxml import etree from rpclib.const import xml_ns as namespace from rpclib.model import ModelBase from rpclib.model.complex import XmlAttribute +from rpclib.model.primitive import AnyXml from rpclib.util.etreeconv import dict_to_etree def complex_add(interface, cls): @@ -82,9 +83,21 @@ def complex_add(interface, cls): if v != cls: interface.add(v) - member = etree.SubElement(sequence, '{%s}element' % namespace.xsd) - member.set('name', k) - member.set('type', v.get_type_name_ns(interface)) + member = etree.SubElement(sequence, v.Attributes.schema_tag) + if v.Attributes.schema_tag == '{%s}element' % namespace.xsd: + member.set('name', k) + member.set('type', v.get_type_name_ns(interface)) + + elif v.Attributes.schema_tag == '{%s}any' % namespace.xsd and \ + (v is AnyXml or + (hasattr(v, '_is_clone_of') and v._is_clone_of is AnyXml)): + if v.Attributes.namespace is not None: + member.set('namespace', v.Attributes.namespace) + if v.Attributes.process_contents is not None: + member.set('processContents', v.Attributes.process_contents) + + else: + raise ValueError("Unhandled schema_tag / type combination.") if v.Attributes.min_occurs != 1: # 1 is the xml schema default member.set('minOccurs', str(v.Attributes.min_occurs)) diff --git a/src/rpclib/model/_base.py b/src/rpclib/model/_base.py index 32d5fe7..abf80b1 100644 --- a/src/rpclib/model/_base.py +++ b/src/rpclib/model/_base.py @@ -89,6 +89,10 @@ class ModelBase(object): will imply an iterable of objects as native python type. Can be set to ``float("inf")`` for arbitrary number of arguments.""" + schema_tag = '{%s}element' % rpclib.const.xml_ns.xsd + """The tag used to add a primitives as child to a complex type in the + xml schema.""" + class Annotations(object): """The class that holds the annotations for the given type.""" diff --git a/src/rpclib/model/primitive.py b/src/rpclib/model/primitive.py index 9fc2b6a..9ee2a94 100644 --- a/src/rpclib/model/primitive.py +++ b/src/rpclib/model/primitive.py @@ -74,6 +74,13 @@ class AnyXml(SimpleModel): __type_name__ = 'anyType' + class Attributes(SimpleModel.Attributes): + namespace = None + """Xml-Schema specific namespace attribute""" + + process_contents = None + """Xml-Schema specific processContents attribute""" + @classmethod @nillable_string def to_string(cls, value): The first hunk makes the element tag name parametric. The second hunk adds the parameter to the ModelBase class. So if you want an tag instead of an tag inside a complexType definition, you need to do this: class SomeType(ComplexModel): child = AnyXml(schema_tag='{%s}any' % rpclib.const.xml_ns.xsd, namespace='##other') This is totally off the top of my head, but I guess you get the idea. Does this help? Let me know how it goes. best, burak On 03/29/12 19:32, Alex Railean wrote: > 3. change the code that generates a Python object from XML there's no such thing in rpclib. we don't parse xml schema, only generate it. > - I think it can rely on validate_native, but my understanding is > that I must also define the behaviour of validate_native for this > type - I don't know where to do that > You need to re-implement any additional validation that the the schema validation does in the soft validator as well. In this case, I agree that validate_native in AnyXml is the right place to do it. From burak.arslan at arskom.com.tr Fri Mar 30 01:03:54 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Fri, 30 Mar 2012 02:03:54 +0300 Subject: [Soap-Python] Customizing rpclib with types that modify the schema In-Reply-To: <4F74E8F1.8030306@arskom.com.tr> References: <359299370.20120329193224@gmail.com> <4F74E8F1.8030306@arskom.com.tr> Message-ID: <4F74EA5A.3090801@arskom.com.tr> fyi: https://github.com/plq/rpclib/commit/811f29e0ec83ffb38a479511cbc91db6430b799d fork this and submit a pull request to the arskom/rpclib when you're finished if you think it is a nice start. On 03/30/12 01:57, Burak Arslan wrote: > Hi, > > I thought if I'd just start implementing this, it'd help you more than > a 300-word reply. > > I skimmed the spec very quick and from what I gather, you want an > tag instead of an tag inside the > (...) hierarchy, > right? (correct me if i'm wrong here.) > > if so, here's the patch that is a nice starting point: > > diff --git a/src/rpclib/interface/xml_schema/model/complex.py > b/src/rpclib/interface/xml_schema/model/complex.py > index f99f587..ae0d65c 100644 > --- a/src/rpclib/interface/xml_schema/model/complex.py > +++ b/src/rpclib/interface/xml_schema/model/complex.py > @@ -22,6 +22,7 @@ from lxml import etree > from rpclib.const import xml_ns as namespace > from rpclib.model import ModelBase > from rpclib.model.complex import XmlAttribute > +from rpclib.model.primitive import AnyXml > from rpclib.util.etreeconv import dict_to_etree > > def complex_add(interface, cls): > @@ -82,9 +83,21 @@ def complex_add(interface, cls): > if v != cls: > interface.add(v) > > - member = etree.SubElement(sequence, '{%s}element' % > namespace.xsd) > - member.set('name', k) > - member.set('type', v.get_type_name_ns(interface)) > + member = etree.SubElement(sequence, v.Attributes.schema_tag) > + if v.Attributes.schema_tag == '{%s}element' % namespace.xsd: > + member.set('name', k) > + member.set('type', v.get_type_name_ns(interface)) > + > + elif v.Attributes.schema_tag == '{%s}any' % namespace.xsd > and \ > + (v is AnyXml or > + (hasattr(v, '_is_clone_of') and > v._is_clone_of is AnyXml)): > + if v.Attributes.namespace is not None: > + member.set('namespace', v.Attributes.namespace) > + if v.Attributes.process_contents is not None: > + member.set('processContents', > v.Attributes.process_contents) > + > + else: > + raise ValueError("Unhandled schema_tag / type > combination.") > > if v.Attributes.min_occurs != 1: # 1 is the xml schema > default > member.set('minOccurs', str(v.Attributes.min_occurs)) > diff --git a/src/rpclib/model/_base.py b/src/rpclib/model/_base.py > index 32d5fe7..abf80b1 100644 > --- a/src/rpclib/model/_base.py > +++ b/src/rpclib/model/_base.py > @@ -89,6 +89,10 @@ class ModelBase(object): > will imply an iterable of objects as native python type. Can > be set to > ``float("inf")`` for arbitrary number of arguments.""" > > + schema_tag = '{%s}element' % rpclib.const.xml_ns.xsd > + """The tag used to add a primitives as child to a complex > type in the > + xml schema.""" > + > class Annotations(object): > """The class that holds the annotations for the given type.""" > > diff --git a/src/rpclib/model/primitive.py > b/src/rpclib/model/primitive.py > index 9fc2b6a..9ee2a94 100644 > --- a/src/rpclib/model/primitive.py > +++ b/src/rpclib/model/primitive.py > @@ -74,6 +74,13 @@ class AnyXml(SimpleModel): > > __type_name__ = 'anyType' > > + class Attributes(SimpleModel.Attributes): > + namespace = None > + """Xml-Schema specific namespace attribute""" > + > + process_contents = None > + """Xml-Schema specific processContents attribute""" > + > @classmethod > @nillable_string > def to_string(cls, value): > > > The first hunk makes the element tag name parametric. > > The second hunk adds the parameter to the ModelBase class. > > So if you want an tag instead of an tag inside a > complexType definition, you need to do this: > > class SomeType(ComplexModel): > child = AnyXml(schema_tag='{%s}any' % rpclib.const.xml_ns.xsd, > namespace='##other') > > This is totally off the top of my head, but I guess you get the idea. > > Does this help? Let me know how it goes. > > best, > burak > > On 03/29/12 19:32, Alex Railean wrote: >> 3. change the code that generates a Python object from XML > > there's no such thing in rpclib. we don't parse xml schema, only > generate it. > > >> - I think it can rely on validate_native, but my understanding is >> that I must also define the behaviour of validate_native for this >> type - I don't know where to do that >> > > You need to re-implement any additional validation that the the schema > validation does in the soft validator as well. In this case, I agree > that validate_native in AnyXml is the right place to do it. > > > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap