[Soap-Python] Spyne: ability to change default results name from FooResult to WhateverXyz ?

Burak Arslan burak.arslan at arskom.com.tr
Wed Apr 15 09:58:52 CEST 2015



On 04/14/15 21:08, Patricio Stegmann Gmail wrote:
> Hello,
> I am looking at a way to change the default behaviour on output
> generation with soap.
> Basically spyne creates the typedefs but responds with its
> autogenerated names:
> /
> //<senv:Envelope xmlns:tns="tns" xmlns:s0="datamodel"
> xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">//
> //   <senv:Body>//
> //*      <tns:helloResponse>*//*
> *//*         <tns:helloResult>*//
> //            <s0:param2>myval</s0:param2>//
> //            <s0:param1>1</s0:param1>//
> //*         </tns:helloResult>*//*
> *//*      </tns:helloResponse>*//
> //   </senv:Body>//
> //</senv:Envelope>/
>
> I need to change the default name of helloResult. I could already
> manage it for helloResponse, by using on the srpc decorator the
> parameter _in_message_name etc... However, I dont know how to change
> the name for helloResult. I tried, on the return type, to do something
> like this:

You need to use the bare mode. This disables auto class generation and
uses classes supplied by you. Bare mode supports only one input and one
output argument. You need to use a ComplexModel if you need to work with
more than one argument in input or output.

class HelloCustomResponse(ComplexModel):
    #(...)

@rpc( (...) ,_body_style='bare', _returns=HelloCustomResponse)

hth,
burak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/soap/attachments/20150415/31398af6/attachment.html>


More information about the Soap mailing list