Savon ignores namespace_identifier attribute

I'm trying to overwrite the written sab namespace - ins0 I have this client variable:

client = Savon.client(wsdl: "https://integcert.synxis.com/interface/Contracts/ChannelConnect2004.wsdl", log_level: :debug, log: true, pretty_print_xml: true, env_namespace: :soapenv, namespaces: {"xmlns:soapenv": "http://schemas.xmlsoap.org/soap/envelope/", "xmlns:head": "http://htng.org/1.1/Header/","xmlns:ns": "http://www.opentravel.org/OTA/2003/05"}, convert_request_keys_to: :none, namespace_identifier: "ns", element_form_default: :qualified)

And when Am makes a request:

client.call(:ping, soap_header: { "head:HTNGHeader": { "head:From": { "head:Credential": { "head:userName": "******", "head:password":"*****" }}}}, message: {"ns:EchoData": "TestData"})

I have this rq soap body:

    <soapenv:Body>
    <ins0:OTA_PingRQ>
      <ns:EchoData>TestData</ns:EchoData>
    </ins0:OTA_PingRQ>
  </soapenv:Body>

Where does this ins0 come from?

Also, when I tried to define a client with a parameter namespace_identifier: niland made this request:

client.call(:ping, soap_header: { "head:HTNGHeader": { "head:From": { "head:Credential": { "head:userName": "******", "head:password":"*****" }}}}, message: {"ns:OTA_PingRQ": {"ns:EchoData": "TestData"}})

I have this rq soap body:

 <soapenv:Body>
<OTA_PingRQ>
  <ns:OTA_PingRQ>
    <ns:EchoData>TestData</ns:EchoData>
  </ns:OTA_PingRQ>
</OTA_PingRQ>

And the correct body that I want to have is:

<soapenv:Body>   
   <ns:OTA_PingRQ>
   <ns:EchoData>TestData</ns:EchoData>
   </ns:OTA_PingRQ>
</soapenv:Body>

Any ideas on how to remove an extra nested OTA_PingRQnode or replace a ins0custom namespace ?

+4
source share
1 answer

, , Savon . , WSDL. element_form_default: :qualified element_form_default: :unqualified, - ins0 OTA_PingRQ node . , ins0, ins0. . , Savon , ins1.

:

client = Savon.client(
  wsdl: "https://integcert.synxis.com/interface/Contracts/ChannelConnect2004.wsdl", 
  log_level: :debug, 
  log: true, 
  pretty_print_xml: true, 
  namespace_identifier: :ins0, 
  element_form_default: :qualified,
  soap_header: { 
    "ins1:HTNGHeader": { 
      "ins1:From": { 
        "ins1:Credential": { 
           "ins1:userName": "******", 
           "ins1:password":"*****" 
        }
      }
    }
  }
)

client.call(:ping, message: {"EchoData": "TestData"})

:

<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ins0="http://www.opentravel.org/OTA/2003/05" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins1="http://htng.org/1.1/Header/">
  <env:Header>
    <ins1:HTNGHeader>
      <ins1:From>
        <ins1:Credential>
          <ins1:userName>******</ins1:userName>
          <ins1:password>*****</ins1:password>
        </ins1:Credential>
      </ins1:From>
    </ins1:HTNGHeader>
  </env:Header>
  <env:Body>
    <ins0:OTA_PingRQ>
      <ins0:echoData>TestData</ins0:echoData>
    </ins0:OTA_PingRQ>
  </env:Body>
</env:Envelope>

:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <OTA_PingRS xmlns="http://www.opentravel.org/OTA/2003/05" PrimaryLangID="en">
      <Errors>
        <Error Type="4" ShortText="Login failed"/>
      </Errors>
      <EchoData/>
    </OTA_PingRS>
  </soap:Body>
</soap:Envelope>

: soap_header , .

0

Source: https://habr.com/ru/post/1658459/


All Articles