From marikkan at gmail.com Wed Jun 6 15:13:32 2012 From: marikkan at gmail.com (Mehmet Arikkan) Date: Wed, 6 Jun 2012 16:13:32 +0300 Subject: [Soap-Python] How to change SOAP response headers In-Reply-To: <4FC342FC.2030200@arskom.com.tr> References: <4FBD0938.5040703@inverse.ca> <4FBD573B.3080601@arskom.com.tr> <4FBFC085.5070006@arskom.com.tr> <4FBFCBE8.5000203@arskom.com.tr> <4FC342FC.2030200@arskom.com.tr> Message-ID: Hi Burak, If I comment out the below _on_method_call and instead change say_hello function to this: class HelloWorldService(ServiceBase): __out_header__ = RespHeader @rpc(Unicode, Integer, _returns=Iterable(Unicode)) def say_hello(ctx, name, times): ctx.out_header = RespHeader() ctx.out_header.Elem1 = 'Test1' for i in range(times): yield u'Hello, %s' % name I do not see Soap Header put in the message. Is this not a proper way? How else can I introduce method specific headers? On Mon, May 28, 2012 at 12:18 PM, Burak Arslan wrote: > On 05/28/12 10:57, Mehmet Arikkan wrote: > > Hi Burak, > > I have found this answer as well, please don't bother :). I guess I have > to use @rpc instead of @sprc so that I can include ctx variable. Please let > me know if I am mistaken. > > > Merhaba, > > Yes, you're correct. And in case you think I should make any additions to > the documentation, please let me know. > > Best, > Burak > > > > Regards, > Mehmet > > On Mon, May 28, 2012 at 10:34 AM, Mehmet Arikkan wrote: > >> Hi Burak, >> >> "You could also do it in the user code as well, without messing with >> events at all, in case you need to add method-specific headers." >> >> Could you please give an example about this method? This is what I need. >> I think I don't have a clear understanding on how I can use the "ctx" >> variable in an @rpc or @srpc decorator function. >> >> Suppose I have two methods A and B and I want to include an AHeader and >> a BHeader in them respectively. How can I do that, could you please >> elaborate with a simple example? >> >> Regards, >> Mehmet >> >> On Fri, May 25, 2012 at 9:14 PM, Burak Arslan < >> burak.arslan at arskom.com.tr> wrote: >> >>> On 05/25/12 21:09, Mehmet Arikkan wrote: >>> >>> Actually what I meant to ask is that whether my way to add the header is >>> a proper way: >>> >>> def _on_method_call(ctx): >>> ctx.out_header = RespHeader() >>> ctx.out_header.Elem1 = 'Test1' >>> ctx.out_header.Elem2 = 'Test2' >>> >>> HelloWorldService.event_manager.add_listener('method_call', >>> _on_method_call) >>> >>> Is this how you would properly add a SOAP Header to your outgoing >>> message? >>> >>> >>> Yes, you could do it like this with events if you want to add that >>> header to every response regardless of the method name. You could also do >>> it in the user code as well, without messing with events at all, in case >>> you need to add method-specific headers. >>> >>> Does that help? >>> >>> Best, >>> Burak >>> >>> >>> _______________________________________________ >>> Soap mailing list >>> Soap at python.org >>> http://mail.python.org/mailman/listinfo/soap >>> >>> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Fri Jun 8 20:07:01 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Fri, 08 Jun 2012 21:07:01 +0300 Subject: [Soap-Python] How to change SOAP response headers In-Reply-To: References: <4FBD0938.5040703@inverse.ca> <4FBD573B.3080601@arskom.com.tr> <4FBFC085.5070006@arskom.com.tr> <4FBFCBE8.5000203@arskom.com.tr> <4FC342FC.2030200@arskom.com.tr> Message-ID: <4FD23F45.4000001@arskom.com.tr> Merhaba, Python doesn't run generator functions until first iteration. The fix was to make sure header is processed *after* body in the soap protocol. The latest commits from pull 141 fixes this, with a lot of other bugs mostly regarding html generation. So if you use the latest code from arskom/rpclib repo, you should see the headers properly generated. Let me know if you have any other issues. Best, Burak On 06/06/12 16:13, Mehmet Arikkan wrote: > Hi Burak, > > If I comment out the below _on_method_call and instead change > say_hello function to this: > > class HelloWorldService(ServiceBase): > __out_header__ = RespHeader > > @rpc(Unicode, Integer, _returns=Iterable(Unicode)) > def say_hello(ctx, name, times): > ctx.out_header = RespHeader() > ctx.out_header.Elem1 = 'Test1' > for i in range(times): > yield u'Hello, %s' % name > > I do not see Soap Header put in the message. Is this not a proper way? > How else can I introduce method specific headers? > > On Mon, May 28, 2012 at 12:18 PM, Burak Arslan > > wrote: > > On 05/28/12 10:57, Mehmet Arikkan wrote: >> Hi Burak, >> >> I have found this answer as well, please don't bother :). I guess >> I have to use @rpc instead of @sprc so that I can include ctx >> variable. Please let me know if I am mistaken. >> > > Merhaba, > > Yes, you're correct. And in case you think I should make any > additions to the documentation, please let me know. > > Best, > Burak > > > >> Regards, >> Mehmet >> >> On Mon, May 28, 2012 at 10:34 AM, Mehmet Arikkan >> > wrote: >> >> Hi Burak, >> >> "You could also do it in the user code as well, without >> messing with events at all, in case you need to add >> method-specific headers." >> >> Could you please give an example about this method? This is >> what I need. I think I don't have a clear understanding on >> how I can use the "ctx" variable in an @rpc or @srpc >> decorator function. >> >> Suppose I have two methods A and B and I want to include an >> AHeader and a BHeader in them respectively. How can I do >> that, could you please elaborate with a simple example? >> >> Regards, >> Mehmet >> >> On Fri, May 25, 2012 at 9:14 PM, Burak Arslan >> > > wrote: >> >> On 05/25/12 21:09, Mehmet Arikkan wrote: >>> Actually what I meant to ask is that whether my way to >>> add the header is a proper way: >>> >>> def _on_method_call(ctx): >>> ctx.out_header = RespHeader() >>> ctx.out_header.Elem1 = 'Test1' >>> ctx.out_header.Elem2 = 'Test2' >>> >>> HelloWorldService.event_manager.add_listener('method_call', >>> _on_method_call) >>> >>> Is this how you would properly add a SOAP Header to your >>> outgoing message? >>> >> >> Yes, you could do it like this with events if you want to >> add that header to every response regardless of the >> method name. You could also do it in the user code as >> well, without messing with events at all, in case you >> need to add method-specific headers. >> >> Does that help? >> >> Best, >> Burak >> >> >> _______________________________________________ >> Soap mailing list >> Soap at python.org >> http://mail.python.org/mailman/listinfo/soap >> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Tue Jun 19 06:25:38 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 19 Jun 2012 07:25:38 +0300 Subject: [Soap-Python] rpclib .net interop In-Reply-To: References: Message-ID: <4FDFFF42.7040507@arskom.com.tr> On 06/18/12 19:36, nbmagus wrote: > Hello Burak, > > First of all I would like to thank you for your great rpclib. Secondly > I saw that .NET interop tests are missing. I would like to volunteer > myself to help you with those tests. > Hi Nick, First, thank you very much for your kind words and your proposition. > If it is OK with you - can you explain what is your interop strategy? > Can those tests be created in pure python? And in what extend you aim > rpclib to be .NET compatible? > The only non-python interop tests that we have are the ruby ones -- all two of them :) They reside in rpclib/test/interop/test_rpc.rb. (and actually fail because ruby's RPC library somehow makes an invalid SOAP request). In the same vein, I was thinking of having a Visual Studio (and/or Mono) project in rpclib/test/interop/dotnet which tests the serialization of various data types by calling echo_* services in the rpclib.test.interop.server._services (via HTTP) It'd also be nice if they were pure python tests, but I don't know how you'd do it. IronPython maybe? We have a run_tests.sh in the test directory, could it be somehow modified to run .Net tests as well? Maybe we could just integrate WS-I tests for SOAP messages and be done with it? As for my aim, is 100% compatibility is too ambitious? I'm open to suggestions as my familiarity with the Microsoft ecosystem is quite minimal. Best Regards, Burak PS: You should also join our mailing list, cc'd. > I have all necessary .NET facilities and hopefully will be able to > assist you with that goal. > > With regards, > Nick Barykine From azurit at pobox.sk Sun Jun 24 22:53:22 2012 From: azurit at pobox.sk (azurIt) Date: Sun, 24 Jun 2012 22:53:22 +0200 Subject: [Soap-Python] rpclib+ https Message-ID: <20120624225322.1E821778@pobox.sk> Hi, i'm trying to set up an soap server on HTTP + HTTPS but i noticed one problem: WSDL always contains HTTP only address, so soap client is using HTTPS only for downloading WSDL. Is it, somehow, possible to include HTTP address in WSDL garbbed via HTTP and HTTPS address in WSDL grabbed via HTTPS? Thnx! azur From burak.arslan at arskom.com.tr Sun Jun 24 23:41:27 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 25 Jun 2012 00:41:27 +0300 Subject: [Soap-Python] rpclib is now spyne Message-ID: <4FE78987.1050704@arskom.com.tr> Hi there, First, I've just renamed rpclib to spyne. No rational reason this time, just didn't like the ring of rpclib. I'll of course make sure the rpclib namespace continues to function as it used to be, so no one should actually notice the name change. I'll also release a soaplib-3.0.0-rc with spyne-2.8.0-rc The upcoming release is going to be a release candidate instead of a beta, as all known bugs are now fixed. I'll issue the release once I'm through with the docs. There are also other changes in the pipeline, stay tuned. Best, Burak From burak.arslan at arskom.com.tr Sun Jun 24 23:41:35 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 25 Jun 2012 00:41:35 +0300 Subject: [Soap-Python] rpclib+ https In-Reply-To: <20120624225322.1E821778@pobox.sk> References: <20120624225322.1E821778@pobox.sk> Message-ID: <4FE7898F.9040201@arskom.com.tr> On 06/24/12 23:53, azurIt wrote: > Hi, > > i'm trying to set up an soap server on HTTP + HTTPS but i noticed one problem: WSDL always contains HTTP only address, so soap client is using HTTPS only for downloading WSDL. Is it, somehow, possible to include HTTP address in WSDL garbbed via HTTP and HTTPS address in WSDL grabbed via HTTPS? Thnx! > hi azur, not with the same wsdl. as you may know, it's generated once and cached forever. if you want the url in the wsdl to be different, you have to have two separate python processes for http and https. that said, i'd always publish the https url without running separate processes: app = WsgiApplication(...) from spyne.interface.wsdl import Wsdl11 wsdl = Wsdl11(self.app.interface) wsdl.build_interface_document("https://example.com/some_app/?wsdl") app._wsdl = wsdl.get_interface_document() note that this is not part of the public api, so the _wsdl attribute can change. i'll try to let you know when this happens though. best, burak From burak.arslan at arskom.com.tr Sun Jun 24 23:51:10 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 25 Jun 2012 00:51:10 +0300 Subject: [Soap-Python] rpclib+ https In-Reply-To: <4FE7898F.9040201@arskom.com.tr> References: <20120624225322.1E821778@pobox.sk> <4FE7898F.9040201@arskom.com.tr> Message-ID: <4FE78BCE.5010504@arskom.com.tr> On 06/25/12 00:41, Burak Arslan wrote: > app = WsgiApplication(...) > from spyne.interface.wsdl import Wsdl11 > wsdl = Wsdl11(self.app.interface) > wsdl.build_interface_document("https://example.com/some_app/?wsdl") > app._wsdl = wsdl.get_interface_document() this code is wrong, sorry! clipboard gone awry. app = Application(...) wsgi_app = WsgiApplication(app) wsdl = Wsdl11(app.interface) wsdl.build_interface_document("https://example.com/some_app/?wsdl") wsgi_app._wsdl = wsdl.get_interface_document() best, burak From azurit at pobox.sk Mon Jun 25 00:13:45 2012 From: azurit at pobox.sk (azurIt) Date: Mon, 25 Jun 2012 00:13:45 +0200 Subject: [Soap-Python] rpclib is now spyne In-Reply-To: <4FE78987.1050704@arskom.com.tr> References: <4FE78987.1050704@arskom.com.tr> Message-ID: <20120625001345.92E0E5E9@pobox.sk> Hi Burak, thnx for cool news! I'm looking forward for the stable release of rpclib/spyne! :) Btw, what does spyne means? Are you really releasing new version of soaplib? I thought it's deprecated and won't be maintained anymore. One more thing: there is a typo on rpclib github page in description - foreseeable feature vs. future. azur ______________________________________________________________ > Od: "Burak Arslan" > Komu: "soap at python.org" > D?tum: 24.06.2012 23:41 > Predmet: [Soap-Python] rpclib is now spyne > >Hi there, > >First, I've just renamed rpclib to spyne. No rational reason this time, >just didn't like the ring of rpclib. > >I'll of course make sure the rpclib namespace continues to function as >it used to be, so no one should actually notice the name change. I'll >also release a soaplib-3.0.0-rc with spyne-2.8.0-rc > >The upcoming release is going to be a release candidate instead of a >beta, as all known bugs are now fixed. I'll issue the release once I'm >through with the docs. > >There are also other changes in the pipeline, stay tuned. > >Best, >Burak > >_______________________________________________ >Soap mailing list >Soap at python.org >http://mail.python.org/mailman/listinfo/soap > From azurit at pobox.sk Mon Jun 25 00:14:31 2012 From: azurit at pobox.sk (azurIt) Date: Mon, 25 Jun 2012 00:14:31 +0200 Subject: [Soap-Python] rpclib+ https In-Reply-To: <4FE78BCE.5010504@arskom.com.tr> References: <20120624225322.1E821778@pobox.sk>, <4FE7898F.9040201@arskom.com.tr> <4FE78BCE.5010504@arskom.com.tr> Message-ID: <20120625001431.2BEBDFC9@pobox.sk> Thnx i will look at it. azur ______________________________________________________________ > Od: "Burak Arslan" > Komu: azurIt > D?tum: 24.06.2012 23:51 > Predmet: Re: [Soap-Python] rpclib+ https > > CC: "soap" >On 06/25/12 00:41, Burak Arslan wrote: >> app = WsgiApplication(...) >> from spyne.interface.wsdl import Wsdl11 >> wsdl = Wsdl11(self.app.interface) >> wsdl.build_interface_document("https://example.com/some_app/?wsdl") >> app._wsdl = wsdl.get_interface_document() > > >this code is wrong, sorry! clipboard gone awry. > >app = Application(...) >wsgi_app = WsgiApplication(app) >wsdl = Wsdl11(app.interface) >wsdl.build_interface_document("https://example.com/some_app/?wsdl") >wsgi_app._wsdl = wsdl.get_interface_document() > >best, >burak > From burak.arslan at arskom.com.tr Mon Jun 25 00:58:58 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 25 Jun 2012 01:58:58 +0300 Subject: [Soap-Python] rpclib is now spyne In-Reply-To: References: <4FE78987.1050704@arskom.com.tr> Message-ID: <4FE79BB2.1000104@arskom.com.tr> Hi All, Spine is the vertebral column, the bone on your back that is supposed to keep you vertical, and the one that houses the neural connections between your brain and the rest of your body. https://en.wikipedia.org/wiki/Spine This spine is a Python library though, so Spyne it is. It seems like there's a comic character named Spyne, but I doubt it'll cause any confusion. As for the Soaplib release, yes Soaplib's deprecated, and no, soaplib-3.0 won't be compatible with the current soaplib-2.0.whatever-beta that is currently in pypi. In fact, I imagine it'll break your existing setups quite badly, as I don't even remember what soaplib can and can't do. That was a loong time ago. But, I'd made a promise almost a year ago: http://mail.python.org/pipermail/soap/2011-September/000526.html My understanding is that most of you use this package because it offers decent soap support. So some of you did not really agree with my transforming soaplib into a general-purpose rpc framework, because providing abstraction over multiple rpc protocols meant some soap-specific functionality had to go. (like the @document decorator) So the plan was to transform soaplib into a spyne wrapper and tuck soap-specific functionality inside soaplib, and release it as soaplib-3.0. But of course, that plan is not set in stone. If you'd rather NOT see another backwards-incompatible soaplib release in pypi, please let the list know. I'll happily keep my promise of releasing a final stable soaplib-3.0 that will bring all the recent developments in spyne to the soaplib namespace, but if nobody wants it, well, I'll be one less thing to worry about for me :) Best, Burak On 06/25/12 01:16, Rapha?l Barrois wrote: > Hi Burak, > > Since you're mentioning a new soaplib release here, does it mean there is a simple upgrade path from soaplib-2.0beta to spyne/soaplib3 ? > I saw your messages stating that soaplib was now deprecated in favor of rpclib, and thought about making the switch too ? we were using soaplib so far, and it worked well for us, so no real need to upgrade. > > Is the new spyne/rpclib/soaplib backwards-compatible with soaplib ? If not, do you know of a soaplib -> rpclib migration documentation ? > > Thanks, > > Rapha?l BARROIS > > On 24 juin 2012, at 23:41, Burak Arslan wrote: > >> Hi there, >> >> First, I've just renamed rpclib to spyne. No rational reason this time, just didn't like the ring of rpclib. >> >> I'll of course make sure the rpclib namespace continues to function as it used to be, so no one should actually notice the name change. I'll also release a soaplib-3.0.0-rc with spyne-2.8.0-rc >> >> The upcoming release is going to be a release candidate instead of a beta, as all known bugs are now fixed. I'll issue the release once I'm through with the docs. >> >> There are also other changes in the pipeline, stay tuned. >> >> Best, >> Burak >> >> _______________________________________________ >> Soap mailing list >> Soap at python.org >> http://mail.python.org/mailman/listinfo/soap From azurit at pobox.sk Mon Jun 25 10:55:48 2012 From: azurit at pobox.sk (azurIt) Date: Mon, 25 Jun 2012 10:55:48 +0200 Subject: [Soap-Python] rpclib is now spyne In-Reply-To: <4FE79BB2.1000104@arskom.com.tr> References: <4FE78987.1050704@arskom.com.tr>, <4FE79BB2.1000104@arskom.com.tr> Message-ID: <20120625105548.3CE4F1A3@pobox.sk> Btw: # easy_install spyne Searching for spyne Reading http://pypi.python.org/simple/spyne/ Reading http://github.com/arskom/spyne No local packages or download links found for spyne error: Could not find suitable distribution for Requirement.parse('spyne') ______________________________________________________________ > Od: "Burak Arslan" > Komu: "soap at python.org" > D?tum: 25.06.2012 00:59 > Predmet: Re: [Soap-Python] rpclib is now spyne > >Hi All, > >Spine is the vertebral column, the bone on your back that is supposed to >keep you vertical, and the one that houses the neural connections >between your brain and the rest of your body. > >https://en.wikipedia.org/wiki/Spine > >This spine is a Python library though, so Spyne it is. It seems like >there's a comic character named Spyne, but I doubt it'll cause any >confusion. > >As for the Soaplib release, yes Soaplib's deprecated, and no, >soaplib-3.0 won't be compatible with the current >soaplib-2.0.whatever-beta that is currently in pypi. In fact, I imagine >it'll break your existing setups quite badly, as I don't even remember >what soaplib can and can't do. That was a loong time ago. > >But, I'd made a promise almost a year ago: >http://mail.python.org/pipermail/soap/2011-September/000526.html > >My understanding is that most of you use this package because it offers >decent soap support. So some of you did not really agree with my >transforming soaplib into a general-purpose rpc framework, because >providing abstraction over multiple rpc protocols meant some >soap-specific functionality had to go. (like the @document decorator) > >So the plan was to transform soaplib into a spyne wrapper and tuck >soap-specific functionality inside soaplib, and release it as soaplib-3.0. > >But of course, that plan is not set in stone. If you'd rather NOT see >another backwards-incompatible soaplib release in pypi, please let the >list know. I'll happily keep my promise of releasing a final stable >soaplib-3.0 that will bring all the recent developments in spyne to the >soaplib namespace, but if nobody wants it, well, I'll be one less thing >to worry about for me :) > >Best, >Burak > > > >On 06/25/12 01:16, Rapha?l Barrois wrote: >> Hi Burak, >> >> Since you're mentioning a new soaplib release here, does it mean there is a simple upgrade path from soaplib-2.0beta to spyne/soaplib3 ? >> I saw your messages stating that soaplib was now deprecated in favor of rpclib, and thought about making the switch too ? we were using soaplib so far, and it worked well for us, so no real need to upgrade. >> >> Is the new spyne/rpclib/soaplib backwards-compatible with soaplib ? If not, do you know of a soaplib -> rpclib migration documentation ? >> >> Thanks, >> >> Rapha?l BARROIS >> >> On 24 juin 2012, at 23:41, Burak Arslan wrote: >> >>> Hi there, >>> >>> First, I've just renamed rpclib to spyne. No rational reason this time, just didn't like the ring of rpclib. >>> >>> I'll of course make sure the rpclib namespace continues to function as it used to be, so no one should actually notice the name change. I'll also release a soaplib-3.0.0-rc with spyne-2.8.0-rc >>> >>> The upcoming release is going to be a release candidate instead of a beta, as all known bugs are now fixed. I'll issue the release once I'm through with the docs. >>> >>> There are also other changes in the pipeline, stay tuned. >>> >>> Best, >>> Burak >>> >>> _______________________________________________ >>> 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 burak.arslan at arskom.com.tr Mon Jun 25 11:51:45 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 25 Jun 2012 12:51:45 +0300 Subject: [Soap-Python] rpclib is now spyne In-Reply-To: <20120625105548.3CE4F1A3@pobox.sk> References: <4FE78987.1050704@arskom.com.tr>, <4FE79BB2.1000104@arskom.com.tr> <20120625105548.3CE4F1A3@pobox.sk> Message-ID: <4FE834B1.30403@arskom.com.tr> On 06/25/12 11:55, azurIt wrote: > Btw: > > # easy_install spyne > Searching for spyne > Reading http://pypi.python.org/simple/spyne/ > Reading http://github.com/arskom/spyne > No local packages or download links found for spyne > error: Could not find suitable distribution for Requirement.parse('spyne') Well, that's because spyne is not released yet :) I simply registered the package name in pypi. The code is fairly stable now but I've got no idea about how the docs match the code yet. So as I said before, I'll issue the release once I find the opportunity to have a look at them. burak From thomas.akakpo at dakarlug.org Mon Jun 25 12:58:42 2012 From: thomas.akakpo at dakarlug.org (Thomas AYIH-AKAKPO) Date: Mon, 25 Jun 2012 13:58:42 +0300 Subject: [Soap-Python] rpclib is now spyne In-Reply-To: <4FE834B1.30403@arskom.com.tr> References: <4FE78987.1050704@arskom.com.tr> <4FE79BB2.1000104@arskom.com.tr> <20120625105548.3CE4F1A3@pobox.sk> <4FE834B1.30403@arskom.com.tr> Message-ID: Hi Burak, Thanks for the good news. -- e-mail: thomas.akakpo at dakarlug.org jabber: thomas.akakpo at dakarlug.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthony.risinger at corvisa.com Mon Jun 25 19:29:08 2012 From: anthony.risinger at corvisa.com (C Anthony Risinger) Date: Mon, 25 Jun 2012 12:29:08 -0500 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function Message-ID: <4FE89FE4.40403@corvisa.com> hello, while briefly trying to update to the spyne codebase, i am encountering an AssertionError due to spyne enforcing a 1-to-1 mapping between MethodDescriptor and the function it wraps: File "/path/to/spyne/interface/_base.py", line 224, in populate_interface assert not s.get_method_id(method) in self.method_id_map AssertionError ... the problem is that i am currently building the MethodDescriptors dynamically, and mapping to a single _proxy function; this SOAP service is really proxying/exposing another JSON service (no JSON support in rpclib/spyne during development). service definition (disregard custom json functions, unrelated): ----------------------------------------------- from rpclib import MethodDescriptor from rpclib.interface.wsdl import Wsdl11 from rpclib.service import ServiceBase from requests import request import json from awesome import models API_VERISION_JSON = 1 API_VERISION_SOAP = 1 METHODS = [('method_one', 'put', 'some method two'), ('method_two', 'post', 'some method two')] def _bind(udp): m, verb, doc = udp def f(*args, **kwds): name = kwds['_default_function_name'] in_message = getattr(models, m) out_message = getattr(models, m+'Response', None) if out_message is None: out_message = getattr(models, m+'_response') desc = MethodDescriptor(function=_proxy, in_message=in_message, out_message=out_message, doc=doc, is_callback=False, is_async=False, mtom=False, in_header=None, out_header=None, faults=None, port_type=None, no_ctx=False, udp=udp, class_key=name) return desc f.__doc__ = doc f._is_rpc = True return f def _proxy(ctx, req): res = None ret = None method, verb, doc = ctx.descriptor.udp host = 'http://%(SERVER_NAME)s:%(SERVER_PORT)s' % \ ctx.transport.req_env endpoint = '%s/api/v%s/%s/' % (host, API_VERISION_JSON, method) headers = {'content-type': 'application/json'} try: res = request(verb, endpoint, headers=headers, data=json.dumps(req.json(req))) res_json = json.loads(res.text) except Exception, e: import traceback if res: print res.text traceback.print_exc() raise e out_message = ctx.descriptor.out_message if len(out_message._type_info) == 1: out_message = out_message._type_info[0] return out_message.json(res_json) MyService = type('MyService', (ServiceBase,), dict([(udp[0], _bind(udp)) for udp in METHODS])) ----------------------------------------------- ... thats's the complete -- working -- service definition, with only the method list truncated and some names changed to protect the innocent. in short: i store the method name, HTTP verb, and __doc__ in udp, then use that and the transport context to rebuild the real request. i haven't spent much time investigating, but why is this restriction necessary? the solution ATM means needlessly wrapping _proxy for each method with a module level function, since lambdas probably wouldn't work either (albeit, i didn't try :-) how can i solve this cleanly, or better, patch spyne to not care what callable actually implements the method (since the pattern was working rather nicely)? thanks! -- C Anthony ----------------------------------------- CONFIDENTIALITY: The information contained in this communication may be confidential and is intended only for the use of the intended recipient(s). If the reader of this message is not the intended recipient(s), you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete any copy of it from your computer system. From anthony.risinger at corvisa.com Mon Jun 25 20:07:10 2012 From: anthony.risinger at corvisa.com (C Anthony Risinger) Date: Mon, 25 Jun 2012 13:07:10 -0500 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function In-Reply-To: <4FE89FE4.40403@corvisa.com> References: <4FE89FE4.40403@corvisa.com> Message-ID: <4FE8A8CE.5000204@corvisa.com> On 06/25/2012 12:29 PM, C Anthony Risinger wrote: > hello, > > while briefly trying to update to the spyne codebase, i am encountering > an AssertionError due to spyne enforcing a 1-to-1 mapping between > MethodDescriptor and the function it wraps: > > File "/path/to/spyne/interface/_base.py", line 224, in > populate_interface > assert not s.get_method_id(method) in self.method_id_map > AssertionError > > ... the problem is that i am currently building the MethodDescriptors > dynamically, and mapping to a single _proxy function; this SOAP service > is really proxying/exposing another JSON service (no JSON support in > rpclib/spyne during development). since `method_id_map` is only really used in one place, and even then only it's .values() are used (spyne/application.py:161), i converted it to a set() and change the assertion to `(s, method) in ...`, and it seems to work fine :-) buuuut, i am getting an odd error about the XSD trying to import itself(?): File "xmlschema.pxi", line 105, in lxml.etree.XMLSchema.__init__ (src/lxml/lxml.etree.c:132720) lxml.etree.XMLSchemaParseError: Element '{http://www.w3.org/2001/XMLSchema}import': The value of the attribute 'namespace' must not match the target namespace 'http://awesome.service.com/' of the importing schema., line 2 tns.xsd ------------------------ [... model definitions ...] ------------------------ ... ideas? i have to step away from this for now, but it seems like we are just about there. -- C Anthony ----------------------------------------- CONFIDENTIALITY: The information contained in this communication may be confidential and is intended only for the use of the intended recipient(s). If the reader of this message is not the intended recipient(s), you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete any copy of it from your computer system. From burak.arslan at arskom.com.tr Mon Jun 25 20:11:19 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 25 Jun 2012 21:11:19 +0300 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function In-Reply-To: <4FE89FE4.40403@corvisa.com> References: <4FE89FE4.40403@corvisa.com> Message-ID: <4FE8A9C7.8010707@arskom.com.tr> On 06/25/12 20:29, C Anthony Risinger wrote: > hello, > > while briefly trying to update to the spyne codebase, i am > encountering an AssertionError due to spyne enforcing a 1-to-1 mapping > between MethodDescriptor and the function it wraps: > > File "/path/to/spyne/interface/_base.py", line 224, in > populate_interface > assert not s.get_method_id(method) in self.method_id_map > AssertionError > > > i haven't spent much time investigating, but why is this restriction > necessary? This was so that you don't accidentally overwrite functions. But it seems like my assumptions were wrong. > the solution ATM means needlessly wrapping _proxy for each method > with a module level function, since lambdas probably wouldn't work > either (albeit, i didn't try :-) > > how can i solve this cleanly, or better, patch spyne to not care what > callable actually implements the method (since the pattern was working > rather nicely)? > I couldn't run your code, (I don't have the awesome package) but the responsible for this is the get_method_id in ServiceBase. https://github.com/arskom/spyne/blob/master/spyne/service.py#L200 Does replacing the 'descriptor.function.__name__' with 'descriptor.name' solve your problem? burak From anthony.risinger at corvisa.com Mon Jun 25 20:19:39 2012 From: anthony.risinger at corvisa.com (C Anthony Risinger) Date: Mon, 25 Jun 2012 13:19:39 -0500 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function In-Reply-To: <4FE8A9C7.8010707@arskom.com.tr> References: <4FE89FE4.40403@corvisa.com> <4FE8A9C7.8010707@arskom.com.tr> Message-ID: <4FE8ABBB.6060701@corvisa.com> On 06/25/2012 01:11 PM, Burak Arslan wrote: > On 06/25/12 20:29, C Anthony Risinger wrote: >> hello, >> >> while briefly trying to update to the spyne codebase, i am >> encountering an AssertionError due to spyne enforcing a 1-to-1 mapping >> between MethodDescriptor and the function it wraps: >> >> File "/path/to/spyne/interface/_base.py", line 224, in >> populate_interface >> assert not s.get_method_id(method) in self.method_id_map >> AssertionError >> >> >> i haven't spent much time investigating, but why is this restriction >> necessary? > > This was so that you don't accidentally overwrite functions. But it > seems like my assumptions were wrong. > >> the solution ATM means needlessly wrapping _proxy for each method >> with a module level function, since lambdas probably wouldn't work >> either (albeit, i didn't try :-) >> >> how can i solve this cleanly, or better, patch spyne to not care what >> callable actually implements the method (since the pattern was working >> rather nicely)? >> > > I couldn't run your code, (I don't have the awesome package) yeah if it's not obvious i changed the name, but that file is just pure autogenerated Model definitions, so you can sub with any file that contains request Models and corresponding METHOD+'Response' Models, and it *should* work :-) > but the > responsible for this is the get_method_id in ServiceBase. > > https://github.com/arskom/spyne/blob/master/spyne/service.py#L200 > > Does replacing the 'descriptor.function.__name__' with 'descriptor.name' > solve your problem? eureka! yes, either changing to a set() or using descriptor.name solves the issue, thanks! so now i just need to crack the "self-import" problem .... -- C Anthony ----------------------------------------- CONFIDENTIALITY: The information contained in this communication may be confidential and is intended only for the use of the intended recipient(s). If the reader of this message is not the intended recipient(s), you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete any copy of it from your computer system. From burak.arslan at arskom.com.tr Mon Jun 25 20:20:47 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 25 Jun 2012 21:20:47 +0300 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function In-Reply-To: <4FE89FE4.40403@corvisa.com> References: <4FE89FE4.40403@corvisa.com> Message-ID: <4FE8ABFF.6070103@arskom.com.tr> On 06/25/12 20:29, C Anthony Risinger wrote: > out_message = getattr(models, m+'Response', None) btw, we have spyne.const.suffix.RESPONSE_SUFFIX now. burak From burak.arslan at arskom.com.tr Mon Jun 25 20:44:11 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 25 Jun 2012 21:44:11 +0300 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function In-Reply-To: <4FE8ABBB.6060701@corvisa.com> References: <4FE89FE4.40403@corvisa.com> <4FE8A9C7.8010707@arskom.com.tr> <4FE8ABBB.6060701@corvisa.com> Message-ID: <4FE8B17B.3090209@arskom.com.tr> On 06/25/12 21:19, C Anthony Risinger wrote: > >> I couldn't run your code, (I don't have the awesome package) > > > yeah if it's not obvious i changed the name, but that file is just > pure autogenerated Model definitions, so you can sub with any file > that contains request Models and corresponding METHOD+'Response' > Models, and it *should* work :-) > i know but that doesn't make my life any easier. >> but the >> responsible for this is the get_method_id in ServiceBase. >> >> https://github.com/arskom/spyne/blob/master/spyne/service.py#L200 >> >> Does replacing the 'descriptor.function.__name__' with 'descriptor.name' >> solve your problem? > > eureka! yes, either changing to a set() or using descriptor.name > solves the issue, thanks! > > so now i just need to crack the "self-import" problem .... > enable debug logging: logging.getLogger('spyne.interface._base').setLevel(logging.DEBUG) and look where the self import is coming from. this is the line we're hunting for: https://github.com/arskom/spyne/blob/db9085c2deb34fd44c2eb3bd00a31654db6282db/spyne/interface/_base.py#L322 burak From anthony.risinger at corvisa.com Mon Jun 25 20:47:40 2012 From: anthony.risinger at corvisa.com (C Anthony Risinger) Date: Mon, 25 Jun 2012 13:47:40 -0500 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function In-Reply-To: <4FE8ABFF.6070103@arskom.com.tr> References: <4FE89FE4.40403@corvisa.com> <4FE8ABFF.6070103@arskom.com.tr> Message-ID: <4FE8B24C.4030005@corvisa.com> On 06/25/2012 01:20 PM, Burak Arslan wrote: > On 06/25/12 20:29, C Anthony Risinger wrote: >> out_message = getattr(models, m+'Response', None) > > btw, we have spyne.const.suffix.RESPONSE_SUFFIX now. ah nice nice, will be useful ... yeah this service was pre-existing and every single Model is already defined ... including arrays. generated from the existing XSD. kudos on the ARRAY_SUFFIX tho; i wrestled with that for a little bit before realizing i just had to subclass Array in my generated Models and then everything Just Worked (since so many place check issubclass(Array) ... probably should use a duck-type friendly approach eventually, but this works for now) thanks, -- C Anthony ----------------------------------------- CONFIDENTIALITY: The information contained in this communication may be confidential and is intended only for the use of the intended recipient(s). If the reader of this message is not the intended recipient(s), you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete any copy of it from your computer system. From anthony.risinger at corvisa.com Mon Jun 25 21:28:26 2012 From: anthony.risinger at corvisa.com (C Anthony Risinger) Date: Mon, 25 Jun 2012 14:28:26 -0500 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function In-Reply-To: <4FE8B17B.3090209@arskom.com.tr> References: <4FE89FE4.40403@corvisa.com> <4FE8A9C7.8010707@arskom.com.tr> <4FE8ABBB.6060701@corvisa.com> <4FE8B17B.3090209@arskom.com.tr> Message-ID: <4FE8BBDA.4030604@corvisa.com> On 06/25/2012 01:44 PM, Burak Arslan wrote: > On 06/25/12 21:19, C Anthony Risinger wrote: >> >>> I couldn't run your code, (I don't have the awesome package) >> >> >> yeah if it's not obvious i changed the name, but that file is just >> pure autogenerated Model definitions, so you can sub with any file >> that contains request Models and corresponding METHOD+'Response' >> Models, and it *should* work :-) >> > > i know but that doesn't make my life any easier. yes i know :-( sorry about that. sometimes difficult to timely provide enough context, but still omit the details i must. will try a bit harder to ensure reproductions work OOTB. >>> but the >>> responsible for this is the get_method_id in ServiceBase. >>> >>> https://github.com/arskom/spyne/blob/master/spyne/service.py#L200 >>> >>> Does replacing the 'descriptor.function.__name__' with 'descriptor.name' >>> solve your problem? >> >> eureka! yes, either changing to a set() or using descriptor.name >> solves the issue, thanks! >> >> so now i just need to crack the "self-import" problem .... > > enable debug logging: > > logging.getLogger('spyne.interface._base').setLevel(logging.DEBUG) > > and look where the self import is coming from. > > this is the line we're hunting for: > https://github.com/arskom/spyne/blob/db9085c2deb34fd44c2eb3bd00a31654db6282db/spyne/interface/_base.py#L322 ok, debug isn't working quite right for some reason, probably because i'm currently using the rpclib wrapper to test before i s,rpclib,spyne,g ... so i just print'ed it instead: importing 'http://awesome.service.com/' to 'http://awesome.service.com/' because 'address_' extends 'address' ... now i see this is probably my issue. to give context, `address` is a Model for a legacy service, using camelCase, and `address_` is the "new" service ... virtually identical except it uses underscores and adds a `type` member: models.py (autogenerated, edited) ---------------------------------- std = {'nillable': False, 'max_occurs': 1, 'min_occurs': 1} ns = 'http://awesome.service.com/' address = type('address', (ComplexModel,), {'__namespace__': ns, '_type_info': {'city': String.customize(**std), 'state': String.customize(**std), 'street': String.customize(**std), 'zip': String.customize(**std)}}) address_ = type('address_', (ComplexModel,), {'__extends__': address.customize(**std), '__namespace__': ns, '_type_info': {'type': String.customize(**std)}}) ---------------------------------- ... sorry i had to edit that for posting, but i don't think you'll need real code here; am i doing that right? and what is the proper way to expose the two services? should i just make a second Service() instance and add it like: Application(services=[serviceCamnelCase, service_underscores]) ... i'd like to share types because ~1/2 overlap. note: my application does this hacky business to patch in JSON support: SimpleModel.__bases__ += (XSimpleJson,) ComplexModel.__bases__ += (XComplexJson,) Array.__bases__ += (XIterableJson,) ... which are mixin classes that simply add a few methods (to_json/etc). i also don't use String directly, i instead use pre-generated Primitives (Strings with patterns/limits/etc). i'm almost certain neither are affecting here, though i'm mentioning just in case. i edited the excerpt to improve clarity only, nothing else. thanks again Burak, much appreciated. -- C Anthony ----------------------------------------- CONFIDENTIALITY: The information contained in this communication may be confidential and is intended only for the use of the intended recipient(s). If the reader of this message is not the intended recipient(s), you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete any copy of it from your computer system. From anthony.risinger at corvisa.com Mon Jun 25 21:33:30 2012 From: anthony.risinger at corvisa.com (C Anthony Risinger) Date: Mon, 25 Jun 2012 14:33:30 -0500 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function In-Reply-To: <4FE8BBDA.4030604@corvisa.com> References: <4FE89FE4.40403@corvisa.com> <4FE8A9C7.8010707@arskom.com.tr> <4FE8ABBB.6060701@corvisa.com> <4FE8B17B.3090209@arskom.com.tr> <4FE8BBDA.4030604@corvisa.com> Message-ID: <4FE8BD0A.90207@corvisa.com> On 06/25/2012 02:28 PM, C Anthony Risinger wrote: > On 06/25/2012 01:44 PM, Burak Arslan wrote: >> >> this is the line we're hunting for: >> https://github.com/arskom/spyne/blob/db9085c2deb34fd44c2eb3bd00a31654db6282db/spyne/interface/_base.py#L322 > > ok, debug isn't working quite right for some reason, probably because > i'm currently using the rpclib wrapper to test before i s,rpclib,spyne,g > ... so i just print'ed it instead: > > importing 'http://awesome.service.com/' to 'http://awesome.service.com/' > because 'address_' extends 'address' ... also, per the output, it was the __extend__ section being called: https://github.com/arskom/spyne/blob/db9085c2deb34fd44c2eb3bd00a31654db6282db/spyne/interface/_base.py#L300 ... the other section you linked was never called. should we be checking if the __extend__ namespace is part of the target namespace (in addition to checking the imports dict) before adding to imports? thanks, -- C Anthony ----------------------------------------- CONFIDENTIALITY: The information contained in this communication may be confidential and is intended only for the use of the intended recipient(s). If the reader of this message is not the intended recipient(s), you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete any copy of it from your computer system. From dieter at handshake.de Mon Jun 25 21:02:19 2012 From: dieter at handshake.de (Dieter Maurer) Date: Mon, 25 Jun 2012 21:02:19 +0200 Subject: [Soap-Python] rpclib is now spyne In-Reply-To: <4FE78987.1050704@arskom.com.tr> References: <4FE78987.1050704@arskom.com.tr> Message-ID: <20456.46523.262726.129777@localhost.localdomain> Burak Arslan wrote at 2012-6-25 00:41 +0300: >First, I've just renamed rpclib to spyne. No rational reason this time, >just didn't like the ring of rpclib. There are good names and there are bad names. A good name is a name that by itself tells something about the thing it denotes. "rpclib" has been quite a good name (I think). -- Dieter From burak.arslan at arskom.com.tr Mon Jun 25 22:36:46 2012 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 25 Jun 2012 23:36:46 +0300 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function In-Reply-To: <4FE8BD0A.90207@corvisa.com> References: <4FE89FE4.40403@corvisa.com> <4FE8A9C7.8010707@arskom.com.tr> <4FE8ABBB.6060701@corvisa.com> <4FE8B17B.3090209@arskom.com.tr> <4FE8BBDA.4030604@corvisa.com> <4FE8BD0A.90207@corvisa.com> Message-ID: <4FE8CBDE.2080900@arskom.com.tr> On 06/25/12 22:33, C Anthony Risinger wrote: > ... the other section you linked was never called. should we be > checking if the __extend__ namespace is part of the target namespace > (in addition to checking the imports dict) before adding to imports? of course :) https://github.com/arskom/spyne/commit/5b39f0de74b07dc520fee256a376540dc1a831ad does it work now? From anthony.risinger at corvisa.com Mon Jun 25 23:02:30 2012 From: anthony.risinger at corvisa.com (C Anthony Risinger) Date: Mon, 25 Jun 2012 16:02:30 -0500 Subject: [Soap-Python] rpclib -> spyne: multiple MethodDescriptor to a single proxy function In-Reply-To: <4FE8CBDE.2080900@arskom.com.tr> References: <4FE89FE4.40403@corvisa.com> <4FE8A9C7.8010707@arskom.com.tr> <4FE8ABBB.6060701@corvisa.com> <4FE8B17B.3090209@arskom.com.tr> <4FE8BBDA.4030604@corvisa.com> <4FE8BD0A.90207@corvisa.com> <4FE8CBDE.2080900@arskom.com.tr> Message-ID: <4FE8D1E6.8020308@corvisa.com> On 06/25/2012 03:36 PM, Burak Arslan wrote: > On 06/25/12 22:33, C Anthony Risinger wrote: >> ... the other section you linked was never called. should we be >> checking if the __extend__ namespace is part of the target namespace >> (in addition to checking the imports dict) before adding to imports? > > of course :) > > https://github.com/arskom/spyne/commit/5b39f0de74b07dc520fee256a376540dc1a831ad > > does it work now? incredible ... It Works! AFAICT everything is now functioning as it was ... hooray! all my "tests" are passing (and by tests i mean some scripts with a couple automated requests until my real tests are completed :-). another job well done. sooo ... i think that's a wrap folks, tune in next week for the shocking conclusion! i'll proceed now with updating to the "frozenish" spyne master ... although ... what are the chances the name changes in the coming weeks? i'm going to be honest ... i thought rpclib was fitting, even if a little bland ;-) thanks much Burak! -- C Anthony ----------------------------------------- CONFIDENTIALITY: The information contained in this communication may be confidential and is intended only for the use of the intended recipient(s). If the reader of this message is not the intended recipient(s), you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete any copy of it from your computer system.