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

Patricio Stegmann Gmail kpoman at gmail.com
Tue Apr 21 05:52:14 CEST 2015


Burak,
The bare parameter is forcing me to have, for the decorated function, 
only one parameter of input, for example (given a Foo method):

/@srpc(FooType, _body_style='bare', _returns=SomeReturnStructure)/

giving the following exception:

/Exception: body_style='bare' can handle at most one function argument./

The request is being sent as this:

<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
     <S:Body>
         <ns2:Initialize 
xmlns="http://standards.iso.org/iso-iec/19794/-1/" xmlns:ns2="tns" 
xmlns:ns3="http://some.domain.com/commonTypes" 
xmlns:ns4="http://standards.iso.org/iso-iec/19794/-4/">
             <ns3:id>some-id</ns3:id>
             <ns3:name>some-name</ns3:nome>
         </ns2:Initialize>
     </S:Body>
</S:Envelope>

However, the responses are being validated. These are auto-generated 
stubs from some java webservices lib, so I guess the consumer of the 
webservice won't do any change in the way he calls my rpc's. Basically 
he calls directly but expects bare naming in return.

How do I fix this ?

Thank you !


On 15/04/2015 04:58, Burak Arslan wrote:
>
>
> 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/20150421/d0fb6914/attachment.html>


More information about the Soap mailing list