Ruby / Savon: Having problems with the namespace for a soap request

I am having problems changing the namespace for the XML SOAP file that I am creating. I'm not sure how to change "xmlns: env =" to "xmlns: soapenv =" and "xmlns: tns =" ​​to "xmlns: web ="

What I'm trying to build:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:web="http://www.webserviceX.NET/">
    <soapenv:Header/>
    <soapenv:Body>
         <web:ConvertTemp>
             <web:Temperature>100</web:Temperature>
             <web:FromUnit>degreeCelsius</web:FromUnit>
             <web:ToUnit>degreeFahrenheit</web:ToUnit>
         </web:ConvertTemp>
    </soapenv:Body>
</soapenv:Envelope>

What I'm getting right now

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.webserviceX.NET/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <env:Body>
      <tns:ConvertTemp>
         <tns:temperature>100</tns:temperature>
         <tns:fromUnit>degreeCelsius</tns:fromUnit>
         <tns:toUnit>degreeFahrenheit</tns:toUnit>
      </tns:ConvertTemp>
   </env:Body>
</env:Envelope>

My code is:

client = Savon.client(wsdl: "http://www.webservicex.net/ConvertTemperature.asmx?WSDL")
message = { temperature: '100',FromUnit: 'degreeCelsius' , ToUnit: 'degreeFahrenheit'}
response = client.call(:convert_temp, message: message)

Thanks for the help.

+4
source share
1 answer

I was able to figure out how to change them. If anyone is interested, a way to change this:

client = Savon.client(env_namespace: :soapenv,namespace_identifier: :web)

However, this did not cause my problem. It turns out that my fields were on camels, and I did not notice. "FromUnit" became "fromUnit".

+12
source

All Articles