Ruby Savon:从请求中删除Soap Action

时间:2011-11-08 03:38:16

标签: ruby soap savon

我正在使用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>

如何修改操作名称?

由于

0 个答案:

没有答案