1

我正在使用 Savon::Model 来发送 SOAP 请求。

我需要的最终结果如下所示:

<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>

我的 WSDL 仅包含名为 ValidateCityPostalCodeZip 的操作,并接受 ValidateCityPostalCodeZipRequest 对象类型作为参数。

当我尝试像代码一样发送请求时:

  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

我获得的格式化 SOAP 查询是

 <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>

这导致调用者出错,这是返回消息的摘录:

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

怎么可能修改操作的名称?

谢谢

4

0 回答 0