0

Sorry for my English. I can not understand how SPYNE generates response to a request to send him. Client sends in this form:

<SOAP-ENV: Envelope xmlns: ns0 = "http://schemas.xmlsoap.org/soap/envelope/" xmlns: ns1 = "localhost" xmlns: xsi = "http://www.w3.org/2001/ XMLSchema-instance "xmlns: SOAP-ENV =" http://schemas.xmlsoap.org/soap/envelope/ ">
    <SOAP-ENV: Header />
    <Ns0: Body>
       <Ns1: prerender>
          <Ns1: secret> secret_key </ ns1: secret>
          <Ns1: requestId> 1 </ ns1: requestId>
          <Ns1: projectId> id1 </ ns1: projectId>
       </ Ns1: prerender>
    </ Ns0: Body>
</ SOAP-ENV: Envelope>

And the server responds as follows:

<Soap11env: Envelope xmlns: soap11env = "http://schemas.xmlsoap.org/soap/envelope/" xmlns: tns = "localhost">
   <Soap11env: Body>
     <Tns: prerenderResponse>
       <Tns: prerenderResult0> secret_key </ tns: prerenderResult0>
       <Tns: prerenderResult1> 1 </ tns: prerenderResult1>
     </ Tns: prerenderResponse>
   </ Soap11env: Body>
</ Soap11env: Envelope>

please tell me how to generate such a response:

<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ns1="localhost" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <ns0:Body>
      <ns1:secret>INT</ns1:commandType>
      <ns1:requestId>STRING</ns1:secret_key>
      <ns1:projectId>INT</ns1:requestId>
    </ns0:Body>
  </SOAP-ENV:Envelope>

If I understand from the documentation. This is done using ComplexModel. But to implement such strukutru I could not get

  • To my knowledge, this is not a valid spyne response. However, you can use lxml.etree and ctx.out_document to return anything you want. – Burak Arslan Jun 21 '16 at 15:44

1 Answers1

0

You can use @rpc(..., _out_variable_names=["foo", "bar"]) to change the tag names prerenderResult0 and prerenderResult1.

To my knowledge, having multiple tags under the SOAP body is not legal. You can change ctx.out_document to anything you like though.

Burak Arslan
  • 7,671
  • 2
  • 15
  • 24