From rinatshigapov at gmail.com Mon Sep 1 12:41:57 2014 From: rinatshigapov at gmail.com (Rinat Shigapov) Date: Mon, 1 Sep 2014 16:41:57 +0400 Subject: [spyne] Custom fault string from exception Message-ID: Hi! At the moment spyne uses `get_fault_string_from_exception` global function to construct messages from server errors. This default is secure but inconvenient in trusted environments. I want to be able to override this function per application basis. I think that `get_fault_string_from_exception` can be a method of `Application` class. Is it a good idea? -- Regards, Rinat Shigapov -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Mon Sep 1 13:08:16 2014 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 01 Sep 2014 16:08:16 +0300 Subject: [spyne] Custom fault string from exception In-Reply-To: References: Message-ID: <54046FC0.2020105@arskom.com.tr> Hello, On 09/01/14 15:41, Rinat Shigapov wrote: > Hi! > > At the moment spyne uses `get_fault_string_from_exception` global > function to construct messages from server errors. This default is > secure but inconvenient in trusted environments. > > I want to be able to override this function per application basis. I > think that `get_fault_string_from_exception` can be a method of > `Application` class. > > Is it a good idea? Yes, you could even make it depend on a parameter. e.g. Application( ..., exception_detail=True) so subclassing is not needed for the most basic use-case. Best, Burak From mnach at ya.ru Tue Sep 2 06:32:19 2014 From: mnach at ya.ru (=?UTF-8?B?0JzQuNGF0LDQuNC7INCd0LDRh9Cw0YDQvtCy?=) Date: Tue, 02 Sep 2014 12:32:19 +0600 Subject: [spyne] Generating wsdl by IP address and another criteria Message-ID: <54056473.80206@ya.ru> Hello Burak! 1. I'm wondering is there a way to generate wsdl at runtime depending on client IP-address? I have checked this by myself in source code of this powerful library, but haven't find a way to do that. 2. If there is no way to do that, can we generate wsdl once per client automatically? Main purpose of this generation thing is to have all our web-services for all consumers in one project, but give them wsdl with only necessary services. Thank you! From burak.arslan at arskom.com.tr Tue Sep 2 13:44:01 2014 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 02 Sep 2014 16:44:01 +0300 Subject: [spyne] Generating wsdl by IP address and another criteria In-Reply-To: <54056473.80206@ya.ru> References: <54056473.80206@ya.ru> Message-ID: <5405C9A1.4080203@arskom.com.tr> Hi there :) On 09/02/14 09:32, ?????? ??????? wrote: > Hello Burak! > > 1. I'm wondering is there a way to generate wsdl at runtime depending > on client IP-address? I have checked this by myself in source code of > this powerful library, but haven't find a way to do that. > > 2. If there is no way to do that, can we generate wsdl once per client > automatically? > > Main purpose of this generation thing is to have all our web-services > for all consumers in one project, but give them wsdl with only > necessary services. I assume you're already aware of this but still: I'd do the IP-based access check in the methods themselves instead of giving them a partial WSDL document, because if the client manages to guess or gets hold of the wsdl document generated for a peer with access to other methods, Spyne won't remember which ip has which wsdl and will answer its query anyway. Having said that, here's how I think you should implement this: First, you need a way to tag the methods (e.g. which ip gets which method). You can use set @rpc's _udp argument[1] to any object. You can store this information there. I have just committed a hook for you to override[2]. You need to subclass Interface and override check_method with something along the lines of: if not (self.ip_address in method.descriptor.udp.ip_addresses): return False return True where ip_address comes as an argument to your Interface subclass' ctor. Assuming you're using WsgiApplication, you need to subclass it and override handle_wsdl_request. >From inside your new WsgiApplication, you must do something along the lines of: ip_addr=req_env['REMOTE_ADDR']) interface = Interface(app, ip_address=ip_address) interface.populate_interface() return Wsdl11(interface).build_interface_document() I can't remember how all this was tied together off the top of my head, but you get the idea. I hope this helps. Best regards, Burak [1]: http://spyne.io/docs/2.10/reference/decorator.html#spyne.decorator.rpc [2]: https://github.com/plq/spyne/commit/3f103f67c560787621d90475cf855a921657db93 From jernej at myprofitsee.com Tue Sep 16 11:35:26 2014 From: jernej at myprofitsee.com (Jernej Makovsek) Date: Tue, 16 Sep 2014 13:35:26 +0200 Subject: [spyne] interactiveRejected exception on upgrade Message-ID: Hi, after upgrading to the latest spyne version the following exception is thrown: Traceback (most recent call last): class PrivateServices(ServiceBase): File ".../virtenv/lib/python2.7/site-packages/spyne/service.py", line 47, in __init__ descriptor = v(_default_function_name=k) File ".../virtenv/lib/python2.7/site-packages/spyne/decorator.py", line 296, in explain_method _in_message_name, _in_variable_names, _no_ctx, _no_self, _args) File ".../virtenv/lib/python2.7/site-packages/spyne/decorator.py", line 71, in _produce_input_message "has %d." % (f.__name__, len(args), len(params))) Exception: 'interactiveRejected' function has 1 argument(s) but its decorator has 2. The problem from my side is that I can't find anything about interactiveRejected in the docs and it seems to be a bug in the library. >From what I read in http://spyne.io/docs/2.11/migration.html?highlight=decorator the problem could be strict checking in the new version. I checked my definitions and there are of the form: @rpc(String(pattern=UUID_PATTERN), String, String, String, _returns=Integer) def foo(ctx, ticket, response, hresult, message): bar which satisfies the strict checking. Any help appreciated! -- Jernej Makovsek, developer at MyProfitSee -------------- next part -------------- An HTML attachment was scrubbed... URL: From jernej at myprofitsee.com Tue Sep 16 11:48:45 2014 From: jernej at myprofitsee.com (Jernej Makovsek) Date: Tue, 16 Sep 2014 13:48:45 +0200 Subject: [spyne] interactiveRejected exception on upgrade In-Reply-To: References: Message-ID: Found the problem. It was in one of our func definitions: @rpc(String(pattern=UUID_PATTERN), String(len_min=1), _returns=String) interactiveRejected(ticket, reason) for some reason it worked in the previous version but now it apparently requires the following definition: interactiveRejected(ctx, ticket, reason) Glad we could solve this one so quickly :). Regards, Jernej On Tue, Sep 16, 2014 at 1:35 PM, Jernej Makovsek wrote: > Hi, > > after upgrading to the latest spyne version the following exception is > thrown: > Traceback (most recent call last): > class PrivateServices(ServiceBase): > File ".../virtenv/lib/python2.7/site-packages/spyne/service.py", line 47, > in __init__ > descriptor = v(_default_function_name=k) > File ".../virtenv/lib/python2.7/site-packages/spyne/decorator.py", line > 296, in explain_method > _in_message_name, _in_variable_names, _no_ctx, _no_self, _args) > File ".../virtenv/lib/python2.7/site-packages/spyne/decorator.py", line > 71, in _produce_input_message > "has %d." % (f.__name__, len(args), len(params))) > Exception: 'interactiveRejected' function has 1 argument(s) but its > decorator has 2. > > The problem from my side is that I can't find anything about > interactiveRejected in the docs and it seems to be a bug in the library. > From what I read in > http://spyne.io/docs/2.11/migration.html?highlight=decorator the problem > could be strict checking in the new version. I checked my definitions and > there are of the form: > @rpc(String(pattern=UUID_PATTERN), String, String, String, > _returns=Integer) > def foo(ctx, ticket, response, hresult, message): > bar > > which satisfies the strict checking. > > Any help appreciated! > -- > Jernej Makovsek, > developer at MyProfitSee > -- Jernej Makovsek, developer at MyProfitSee -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Tue Sep 16 11:49:20 2014 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 16 Sep 2014 14:49:20 +0300 Subject: [spyne] interactiveRejected exception on upgrade In-Reply-To: References: Message-ID: <541823C0.5040107@arskom.com.tr> hi there, On 09/16/14 14:35, Jernej Makovsek wrote: > Hi, > > after upgrading to the latest spyne version the following exception is > thrown: > Traceback (most recent call last): > class PrivateServices(ServiceBase): > File ".../virtenv/lib/python2.7/site-packages/spyne/service.py", line > 47, in __init__ > descriptor = v(_default_function_name=k) > File ".../virtenv/lib/python2.7/site-packages/spyne/decorator.py", > line 296, in explain_method > _in_message_name, _in_variable_names, _no_ctx, _no_self, _args) > File ".../virtenv/lib/python2.7/site-packages/spyne/decorator.py", > line 71, in _produce_input_message > "has %d." % (f.__name__, len(args), len(params))) > Exception: 'interactiveRejected' function has 1 argument(s) but its > decorator has 2. > > The problem from my side is that I can't find anything about > interactiveRejected in the docs and it seems to be a bug in the > library. From what I read > in http://spyne.io/docs/2.11/migration.html?highlight=decorator the > problem could be strict checking in the new version. I checked my > definitions and there are of the form: > @rpc(String(pattern=UUID_PATTERN), String, String, String, > _returns=Integer) > def foo(ctx, ticket, response, hresult, message): > bar > > Interesting. Are you sure you're looking at the correct function? The function above has 4 parameters, not 1 nor 2. The logic in decorator.py is pretty simple, I don't see much room for bugs. Please provide a minimal test case that reproduces the issue, I can't guess what may be causing from the information you provided. Best regards, Burak From roberto.maurizzi at gmail.com Mon Sep 29 07:28:45 2014 From: roberto.maurizzi at gmail.com (Roberto Maurizzi) Date: Mon, 29 Sep 2014 11:28:45 +0400 Subject: [spyne] primitive.DateTime: Attribute.validate_native problem Message-ID: Hello everyone, first post on the list! I'm trying to create a SOAP service that's able to accept requests from an old Windows Mobile application that's sort-of unsupported: its SOAP is more than a little funny but I've been able to work around most issues (I had to use soft validation, etc.) I'm stuck with a problem with a DateTime field: for some of the records the application sends a 0001-01-01T00:00:00 field (no TZ offset, and yes, it's datetime.datetime.min. Processing the request I get a ValidationError raised from spyne/protocol/xml.py after calling cls.validate_native. This happens because in primitive.DateTime Attribute classmethod validate_native the code checks if: value > cls.Attributes.gt and value >= cls.Attributes.ge Since both Attributes.gt and Attributes.ge are set as datetime.datetime(datetime.MINYEAR, 1, 1, 0, 0, 0, 0, spyne.LOCAL_TZ) and spyne.LOCAL_TZ is set to UTC, the first test will fail (I'm using UTC times too)because 0001-01-01 00:00:00+00:00 > 0001-01-01 00:00:00+00:00 is False. It's even more interesting if I try to use a timezone: if it's west of Greenwich, the value > cls.Attributes.gt test does pass. If they're east of it, even value >= cls.Attributes.ge doesn't pass. I'm particularly lucky (well... as someone having to work on this kind of stuff can be ;-) ) because the backend only needs the date component and working times are such that if I set a timezone of GMT-1, everything will "work", but I wonder if there is a better solution to have this "special datetime" pass validation... (... please let me know if it's ok to use the list for this or I should've used github: I'm posting here because it's not a clear problem and maybe will need some discussion ). Roberto Maurizzi -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Mon Sep 29 10:28:08 2014 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 29 Sep 2014 13:28:08 +0300 Subject: [spyne] primitive.DateTime: Attribute.validate_native problem In-Reply-To: References: Message-ID: <54293438.3090307@arskom.com.tr> On 09/29/14 10:28, Roberto Maurizzi wrote: > Hello everyone, first post on the list! > Hello Roberto, Welcome! > I'm trying to create a SOAP service that's able to accept requests > from an old Windows Mobile application that's sort-of unsupported: its > SOAP is more than a little funny but I've been able to work around > most issues (I had to use soft validation, etc.) > > I'm stuck with a problem with a DateTime field: for some of the > records the application sends > a 0001-01-01T00:00:00 field (no TZ offset, > and yes, it's datetime.datetime.min. > > Processing the request I get a ValidationError raised from > spyne/protocol/xml.py after calling cls.validate_native. > This happens because in primitive.DateTime Attribute > classmethod validate_native the code checks if: > > value > cls.Attributes.gt and value >= > cls.Attributes.ge > > Since both Attributes.gt and Attributes.ge are set > as datetime.datetime(datetime.MINYEAR, 1, 1, 0, 0, 0, 0, > spyne.LOCAL_TZ) and spyne.LOCAL_TZ is set to UTC, the first test will > fail (I'm using UTC times too)because 0001-01-01 00:00:00+00:00 > > 0001-01-01 00:00:00+00:00 is False. Hmmm. That's python's fault for making boundary values valid ones. Maybe we can skip gt (and lt) test when it's equal to smallest (and largest) datetime? return SimpleModel.validate_native(cls, value) and ( value is None or ( (cls.Attributes.gt is cls._min_dt or value > cls.Attributes.gt) and value >= cls.Attributes.ge and (cls.Attributes.lt is cls._max_dt or value < cls.Attributes.lt) and value <= cls.Attributes.le )) Do you think that'd be enough? > > (... please let me know if it's ok to use the list for this or I > should've used github: I'm posting here because it's not a clear > problem and maybe will need some discussion ). > it's perfectly fine to use the list. we will file an issue if it's needed. best regards, burak -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto.maurizzi at gmail.com Mon Sep 29 12:50:39 2014 From: roberto.maurizzi at gmail.com (Roberto Maurizzi) Date: Mon, 29 Sep 2014 16:50:39 +0400 Subject: [spyne] primitive.DateTime: Attribute.validate_native problem In-Reply-To: <54293438.3090307@arskom.com.tr> References: <54293438.3090307@arskom.com.tr> Message-ID: > Hello Roberto, Welcome! > > :-) > Hmmm. That's python's fault for making boundary values valid ones. > > Maybe we can skip gt (and lt) test when it's equal to smallest (and > largest) datetime? > > return SimpleModel.validate_native(cls, value) and ( > value is None or ( > (cls.Attributes.gt is cls._min_dt or value > > cls.Attributes.gt) > and value >= cls.Attributes.ge > and (cls.Attributes.lt is cls._max_dt or value < > cls.Attributes.lt) > and value <= cls.Attributes.le > )) > > Do you think that'd be enough? > I did try to simply comment out the value > cls.Attributes.gt case and it works, however: 1) testing your code I don't have any DateTime._min_dt (from cls._min_dt) [spyne 2.11] 2) I'm not so sure a boundary value should be rejected "hard", as a concept... if we had positive nonzero integers would you reject 1? A Boundary has a special meaning and it's often used just because of that. Granted, my case is a very ugly one and the proper fix would be to change the WinMobile client to return a less 'strange' value (or even better, rewrite it for Android and run it on rugged phones/tablets ;-) ) Related to this, while I was experimenting with pytz.timezone, I discovered the "wonderful world" of LMT... and I totally fail to understand why it works like it does. If I create a tz-aware datetime using datetime.datetime(y,m,d,h,m,s, m, tz) (as in Spyne's DateTime) it can either work OR NOT depending on what is tz. UTC works, some other timezone works, but many others will give you things like this: In [4]: tz_dubai = pytz.timezone("Asia/Dubai") In [5]: tz_london = pytz.timezone("Europe/London") In [6]: dubai_time = datetime.datetime(2014, 9, 29, 12, 0, 0, 0, tz_dubai) In [7]: print dubai_time 2014-09-29 12:00:00+03:41 In [8]: print dubai_time.astimezone(tz_london) 2014-09-29 09:19:00+01:00 In [9]: print dubai_time.astimezone(tz_london).astimezone(tz_dubai) 2014-09-29 12:19:00+04:00 According to some sources the right way to create/convert a tz-aware timestamp is to use something like: In [12]: tz_dubai.localize(datetime.datetime.now()) Out[12]: datetime.datetime(2014, 9, 29, 16, 32, 38, 141302, tzinfo=) instead of: In [13]: datetime.datetime(2014, 9, 29, 16, 32, 38, 141302, tzinfo=tz_dubai) Out[13]: datetime.datetime(2014, 9, 29, 16, 32, 38, 141302, tzinfo=) Now I really wonder what the Attributes limits should use for cases when spyne.LOCAL_TZ is changed from UTC and set to some 'wrong' timezone (btw, Python's docs say the 'strange behaviour' comes from timezones that can have DST... but the UAE don't use DST... @___@; ) And here I though SOAP was overly complex... Roberto -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Mon Sep 29 13:12:41 2014 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 29 Sep 2014 16:12:41 +0300 Subject: [spyne] primitive.DateTime: Attribute.validate_native problem In-Reply-To: References: <54293438.3090307@arskom.com.tr> Message-ID: <54295AC9.3030403@arskom.com.tr> On 09/29/14 15:50, Roberto Maurizzi wrote: > > > Hello Roberto, Welcome! > > > :-) > > > Hmmm. That's python's fault for making boundary values valid ones. > > Maybe we can skip gt (and lt) test when it's equal to smallest > (and largest) datetime? > > return SimpleModel.validate_native(cls, value) and ( > value is None or ( > (cls.Attributes.gt > is cls._min_dt or value > cls.Attributes.gt > ) > and value >= cls.Attributes.ge > > and (cls.Attributes.lt > is cls._max_dt or value < cls.Attributes.lt > ) > and value <= cls.Attributes.le > )) > > Do you think that'd be enough? > > > I did try to simply comment out the value > cls.Attributes.gt > case and it works, however: > 1) testing your code I don't have any DateTime._min_dt (from > cls._min_dt) [spyne 2.11] > 2) I'm not so sure a boundary value should be rejected "hard", as a > concept... if we had positive nonzero integers would you reject 1? A > Boundary has a special meaning and it's often used just because of that. My code fragment above ended up like so: https://github.com/plq/spyne/commit/f00cb1aea66d72354330677fd64bd527b369bc4b > > Granted, my case is a very ugly one and the proper fix would be to > change the WinMobile client to return a less 'strange' value (or even > better, rewrite it for Android and run it on rugged phones/tablets ;-) ) Nope, in this case, your client is right. The value *is* valid and should not have any issues with validation. > > > Related to this, while I was experimenting with pytz.timezone, I > discovered the "wonderful world" of LMT... and I totally fail to > understand why it works like it does. > dealing with timezones (not just in Python) are a huge pain and TBH, explaining why Spyne works the way it does warrants a whole blog post of its own. But in short, spyne needs datetimes to always have a time zone. it doesn't touch values with time zones but values without ones are treated as spyne.LOCAL_TZ, which happens to be UTC. I can't think of a single reason why someone would need some other value there. > If I create a tz-aware datetime using datetime.datetime(y,m,d,h,m,s, > m, tz) (as in Spyne's DateTime) it can either work OR NOT depending on > what is tz. UTC works, some other timezone works, but many others will > give you things like this: > > In [4]: tz_dubai = pytz.timezone("Asia/Dubai") > > In [5]: tz_london = pytz.timezone("Europe/London") > > In [6]: dubai_time = datetime.datetime(2014, 9, 29, 12, 0, 0, 0, tz_dubai) > > In [7]: print dubai_time > 2014-09-29 12:00:00+03:41 > > In [8]: print dubai_time.astimezone(tz_london) > 2014-09-29 09:19:00+01:00 > > In [9]: print dubai_time.astimezone(tz_london).astimezone(tz_dubai) > 2014-09-29 12:19:00+04:00 > You will find many inconsistencies like this. The controversy about the time in indiana is a funny read: http://en.wikipedia.org/wiki/Time_in_Indiana if you can come up with test cases (preferably in pull requests!) showing Spyne's soft validation doing the wrong thing on date range constraints, I'd be happy to fix them for you. best regards, burak -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ian.Kane at perrigo.com Mon Sep 29 20:17:36 2014 From: Ian.Kane at perrigo.com (Ian Kane) Date: Mon, 29 Sep 2014 20:17:36 +0000 Subject: [spyne] Trying to expose the basic SOAP interface. Message-ID: Hi all, first time post here. I've been following this library for a few weeks and finally decided to try to make use of it for a project. I've got an application that needs to receive state updates from a communication bus. The com bus should be able to notify my application through an exposed SOAP service. Apparently I have a misunderstanding of the library's API as I have yet to demonstrate a successful test-case. Any insight as to why the below exception is being thrown would be greatly appreciated. Here is my test case: ##SOAP service test suite. ##File: test.py import unittest from lxml import etree from StringIO import StringIO from spyne.application import Application from spyne.service import ServiceBase from spyne.protocol.soap import Soap11 from spyne.decorator import srpc, rpc from spyne.model.complex import ComplexModel from spyne.model.primitive import String, Unicode from spyne.server.wsgi import WsgiApplication import logging logging.basicConfig(level=logging.INFO) #complex model definition, parameters that will be recieved in SOAP call, #idea is to save model to the DB. class IncidentParams(ComplexModel): __type_name__ = 'IncidentParams' __namespace__ = 'tns' IncNum = Unicode.customize( max_len = 15, pattern = 'INC[0-9]+', type_name = 'MajorIncidentNumber') number = IncNum def start_response(code, headers): print(code, headers) class TestService(unittest.TestCase): def test_soap_bare_with_complexInput(self): #service definition class IncidentService(ServiceBase): @srpc(IncidentParams, _returns=IncidentParams) def create_incident(the_incident): #This RPC logs the input and passes it through as the return value. s = etree.tostring(the_incident, pretty_print=True) logging.info("create_incident: Parameters:%s" % s) #Code_to_save_incident_to_DB(the_incident) return the_incident app = Application([IncidentService], 'tns', in_protocol=Soap11(), out_protocol=Soap11(cleanup_namespaces=True)) req = """ INC0000001 """ server = WsgiApplication(app) resp = etree.fromstring(''.join(server({ 'QUERY_STRING': '', 'PATH_INFO': '/create', 'REQUEST_METHOD': 'GET', 'SERVER_NAME': 'localhost', 'wsgi.input': StringIO(req) }, start_response, "http://null"))) print etree.tostring(resp, pretty_print=True) if __name__ == '__main__': unittest.main() Running the attached script from the interpreter throws this uncaught exception: Traceback (most recent call last): File "test.py", line 46, in test_soap_bare_with_complexInput out_protocol=Soap11(cleanup_namespaces=True)) File "c:\Python27\lib\site-packages\spyne-2.10.10-py2.7.egg\spyne\application.py", line 104, in __init__ self.in_protocol.set_app(self) File "c:\Python27\lib\site-packages\spyne-2.10.10-py2.7.egg\spyne\protocol\xml\_base.py", line 413, in set_app xml_schema.build_validation_schema() File "c:\Python27\lib\site-packages\spyne-2.10.10-py2.7.egg\spyne\interface\xml_schema\_base.py", line 170, in build_validation_schema self.build_schema_nodes(with_schema_location=True) File "c:\Python27\lib\site-packages\spyne-2.10.10-py2.7.egg\spyne\interface\xml_schema\_base.py", line 137, in build_schema_nodes self.add(cls, set()) File "c:\Python27\lib\site-packages\spyne-2.10.10-py2.7.egg\spyne\interface\xml_schema\_base.py", line 127, in add handler(self, cls, tags) File "c:\Python27\lib\site-packages\spyne-2.10.10-py2.7.egg\spyne\interface\xml_schema\model.py", line 61, in simple_add interface.get_restriction_tag(cls) File "c:\Python27\lib\site-packages\spyne-2.10.10-py2.7.egg\spyne\interface\xml_schema\_base.py", line 131, in get_restriction_tag return handler(self, cls) File "c:\Python27\lib\site-packages\spyne-2.10.10-py2.7.egg\spyne\interface\xml_schema\model.py", line 246, in unicode_get_restriction_tag restriction = simple_get_restriction_tag(interface, cls) File "c:\Python27\lib\site-packages\spyne-2.10.10-py2.7.egg\spyne\interface\xml_schema\model.py", line 49, in simple_get_restriction_tag restriction.set('base', cls.__extends__.get_type_name_ns( AttributeError: 'NoneType' object has no attribute 'get_type_name_ns' NOTICE: This e-mail message and any attachments are confidential and intended solely for use of the intended recipient. If you are not the intended recipient, you should not review, retransmit, convert to hard copy, copy, use or disseminate this e-mail or any attachments to it. If you have received this e-mail in error, please immediately notify us by return e-mail and delete this message and any attachments from your computer system. Please note that if this e-mail message contains a forwarded message or is a reply to a prior message, some or all of the contents of this message or any attachments may not have been produced by the sender. This notice is automatically appended to each e-mail message leaving the senders e-mail domain. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Tue Sep 30 09:53:06 2014 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 30 Sep 2014 12:53:06 +0300 Subject: [spyne] Trying to expose the basic SOAP interface. In-Reply-To: References: Message-ID: <542A7D82.6020804@arskom.com.tr> On 09/29/14 23:17, Ian Kane wrote: > > Hi all, first time post here. > Hello Ian, Welcome :) > > > I?ve been following this library for a few weeks and finally decided > to try to make use of it for a project. > > > > I?ve got an application that needs to receive state updates from a > communication bus. The com bus should be able to notify my > application through an exposed SOAP service. > > Apparently I have a misunderstanding of the library?s API as I have > yet to demonstrate a successful test-case. Any insight as to why the > below exception is being thrown would be greatly appreciated. > > Here is my test case: > > > > Your code is up at here: https://gist.github.com/plq/c65f567d69167ccd94d6 I fixed a couple of things with it: https://gist.github.com/plq/c65f567d69167ccd94d6/revisions The traceback you provided is certainly a bug, but it appears to be fixed in 2.11, where I couldn't reproduce the error. Is there anything preventing you from upgrading to 2.11? 2.10 series are more than a year old and almost 2000 commits behind master now. Best regards, Burak -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ian.Kane at perrigo.com Tue Sep 30 18:24:12 2014 From: Ian.Kane at perrigo.com (Ian Kane) Date: Tue, 30 Sep 2014 18:24:12 +0000 Subject: [spyne] Trying to expose the basic SOAP interface. In-Reply-To: <542A7D82.6020804@arskom.com.tr> References: <542A7D82.6020804@arskom.com.tr> Message-ID: Thanks Burak, Good to be here. I can?t recall making the conscious decision between 2.11 and 2.10 and can?t believe upgrading wasn?t one of my first actions. Anyways, there is no reason why I can?t move to version 2.11. Doing so fixed the issue, Thanks! -Ian From: people [mailto:people-bounces at spyne.io] On Behalf Of Burak Arslan Sent: Tuesday, September 30, 2014 5:53 AM To: people at spyne.io Subject: Re: [spyne] Trying to expose the basic SOAP interface. On 09/29/14 23:17, Ian Kane wrote: Hi all, first time post here. Hello Ian, Welcome :) I?ve been following this library for a few weeks and finally decided to try to make use of it for a project. I?ve got an application that needs to receive state updates from a communication bus. The com bus should be able to notify my application through an exposed SOAP service. Apparently I have a misunderstanding of the library?s API as I have yet to demonstrate a successful test-case. Any insight as to why the below exception is being thrown would be greatly appreciated. Here is my test case: Your code is up at here: https://gist.github.com/plq/c65f567d69167ccd94d6 I fixed a couple of things with it: https://gist.github.com/plq/c65f567d69167ccd94d6/revisions The traceback you provided is certainly a bug, but it appears to be fixed in 2.11, where I couldn't reproduce the error. Is there anything preventing you from upgrading to 2.11? 2.10 series are more than a year old and almost 2000 commits behind master now. Best regards, Burak NOTICE: This e-mail message and any attachments are confidential and intended solely for use of the intended recipient. If you are not the intended recipient, you should not review, retransmit, convert to hard copy, copy, use or disseminate this e-mail or any attachments to it. If you have received this e-mail in error, please immediately notify us by return e-mail and delete this message and any attachments from your computer system. Please note that if this e-mail message contains a forwarded message or is a reply to a prior message, some or all of the contents of this message or any attachments may not have been produced by the sender. This notice is automatically appended to each e-mail message leaving the senders e-mail domain. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas5th at gmail.com Tue Sep 30 21:49:17 2014 From: thomas5th at gmail.com (=?UTF-8?B?IlRob23DoXMgUy4gQnJlZ29saW4i?=) Date: Tue, 30 Sep 2014 18:49:17 -0300 Subject: [spyne] namespace prefix with suds Message-ID: <542B255D.3080500@gmail.com> Hello, Does anyone know how to fix this: https://github.com/arskom/spyne/issues/242 ? I'm trying to pass a dict to the service, and get the same dict back. The error is "suds.WebFault: Server raised fault: 'Namespace prefix xs on name is not defined, line 1, column 163'" Here's a test case: The server: #!/usr/bin/python #coding=utf-8 from spyne.application import Application from spyne.server.wsgi import WsgiApplication from spyne.decorator import rpc from spyne.service import ServiceBase from spyne.protocol.soap import Soap11 from spyne.model.primitive import AnyDict class myApp(Application): pass class query(ServiceBase): @rpc(AnyDict, _returns=AnyDict) def listItems(ctx, names): return names app = myApp([query], 'localhost.myapp', in_protocol=Soap11(validator='lxml'), out_protocol=Soap11()) application = WsgiApplication(app) if __name__ == '__main__': import logging from wsgiref.simple_server import make_server logging.basicConfig(level=logging.DEBUG) logging.getLogger('spyne.protocol.xml').setLevel(logging.DEBUG) logging.info("listening to http://127.0.0.1:8000") logging.info("wsdl is at: http://localhost:8000/?wsdl") server = make_server('127.0.0.1', 8000, application) server.serve_forever() ************************* The client: #!/usr/bin/python from suds.client import Client c = Client('http://localhost:8000/?wsdl') req = { 'name': 'foo' } res = c.service.listItems(req) print res ************************* The server's output: ERROR:spyne.protocol.soap.soap11.invalid:foo ************************* The client's output: No handlers could be found for logger "suds.client" Traceback (most recent call last): File "./testcasesuds.py", line 7, in res = c.service.listItems(req) File "/usr/lib/python2.7/dist-packages/suds/client.py", line 542, in __call__ return client.invoke(args, kwargs) File "/usr/lib/python2.7/dist-packages/suds/client.py", line 602, in invoke result = self.send(soapenv) File "/usr/lib/python2.7/dist-packages/suds/client.py", line 653, in send result = self.failed(binding, e) File "/usr/lib/python2.7/dist-packages/suds/client.py", line 708, in failed r, p = binding.get_fault(reply) File "/usr/lib/python2.7/dist-packages/suds/bindings/binding.py", line 265, in get_fault raise WebFault(p, faultroot) suds.WebFault: Server raised fault: 'Namespace prefix xs on name is not defined, line 1, column 163' I'm using the packages from Debian Jessie's repo: Python: Version: 2.7.8-1 Spyne: Version: 2.11.0-2 Suds: Version: 0.4.1-14 Thanks, Thomas