Ruby Savon:从请求中删除 Soap 操作

发布于 2024-12-14 03:16:25 字数 2228 浏览 0 评论 0原文

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

Which 导致调用者发生错误,这里是返回消息的摘录:

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 edit the name of the operation?

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文