1

I'm using Savon::Model in order to send a SOAP request.

The final result I need look like this:

<env:Body>
  <ins0:ValidateCityPostalCodeZipRequest>
    <ins0:Addresses>
      <ins0:ShortAddress>
        <ins0:City>Toronto</v1:City>
        <ins0:Province>ON</v1:Province>
        <ins0:Country>CA</v1:Country>
        <ins0:PostalCode>L4Y1K7</v1:PostalCode>
      </ins0:ShortAddress>
    </ins0:Addresses>
  </ins0:ValidateCityPostalCodeZipRequest>
</env:Body>

My WSDL only contains the operation named: ValidateCityPostalCodeZip and accepts as parameter a ValidateCityPostalCodeZipRequest object type.

When I'm trying to send the Request like the code:

  validate_city_postal_code_zip do
    soap.header = {
      "ins0:RequestContext" => {
        "ins0:Version" => "1.0",
        "ins0:Language" => "en",
        "ins0:GroupID" => "11",
        "ins0:RequestReference" => "UserRef"
      }
    }
    soap.body = {
      "ins0:Addresses" => {
        "ins0:ShortAddress" => {
          "ins0:City" => city,
          "ins0:Province" => province,
          "ins0:Country" => country,
          "ins0:PostalCode" => postal_code
        }
      }
    }
  end

The formatted SOAP query I obtain is

 <env:Body>
      <wsdl:ValidateCityPostalCodeZip>
           <ins0:Addresses>
                <ins0:ShortAddress>
                     <ins0:City>te</ins0:City>
                     <ins0:Province>te</ins0:Province>
                     <ins0:Country>te</ins0:Country>
                     <ins0:PostalCode>te</ins0:PostalCode>
                </ins0:ShortAddress>
           </ins0:Addresses>
      </wsdl:ValidateCityPostalCodeZip>
 </env:Body>

Which causing an error from the caller, here's an excerpt from the returned message:

SOAP response (status 200):
[...]
<Errors>
    <Error>
        <Code>3001116</Code>
        <Description>Service Failed</Description>
        <AdditionalInformation i:nil="true"/>
    </Error>
</Errors>

How can it be possible to modify the name of the operation ?

Thanks

0 Answers0