[spyne] defining a service without expecting namespace in every tag

Daniele Bortoluzzi daniele at elkos.it
Tue Aug 11 12:28:44 UTC 2015


On 10 August 2015 at 19:54, Daniele Bortoluzzi <daniele at elkos.it> wrote:

>
> On 10 August 2015 at 19:13, Burak Arslan <burak.arslan at arskom.com.tr>
> wrote:
>
>> if you got issues with namespaces, try soft validation.
>>
>
> I tried soft validation and forgot about namespaces, the input is
validated.

Now I'm struggling with the response generated by Spyne: the result is
wrapped in a <NotifyResult> element.
Looking at the documentation and this post

http://stackoverflow.com/questions/19536282/i-dont-want-spyne-to-wrap-my-response

I saw that _body_style='bare' could be the solution. But if I set that
option, the input is no more validated:

[spyne.application] Notify() takes exactly 2 arguments (3 given)
Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/spyne/application.py",
line 144, in process_request
    ctx.out_object = self.call_wrapper(ctx)
    File "scryba/server.py", line 66, in call_wrapper
    return ctx.service_class.call_wrapper(ctx)
    File "/usr/local/lib/python2.7/dist-packages/spyne/service.py", line
209, in call_wrapper
    return ctx.function(ctx, *ctx.in_object)
    TypeError: Notify() takes exactly 2 arguments (3 given)

that's because the ComplexModel input has two attributes (mytag1,
notifications) while Spyne expects a single container.
If you look at the previous XML I posted for the namespace problem you can
see the only container being the NotifyRequest element. But this is already
used by the method convention, so Spyne expects another container inside
that element.

I don't know if I must go on adjusting the code to accept the input or do
something else to achieve the effect of _body_style='bare' for the output
response.

Thank you in advance,

Daniele

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spyne.io/archives/people/attachments/20150811/ffcfb39f/attachment.html>


More information about the people mailing list