ruby-on-rails - 这两个 SOAP 请求有什么区别?

标签 ruby-on-rails ruby ruby-on-rails-3 soap savon

我正在向 SOAP API 发送请求,不幸的是我对 SOAP 的了解有限。以下两个请求都返回响应,但响应不同。不起作用的示例仅返回 send_fax_response。该工作返回send_fax_response和send_fax_result。有什么想法吗?难道是顺序?

不工作

SOAP request: https://faxregistration.com/SfaxWS/SfaxAPI.asmx
SOAPAction: "http://tempuri.org/sendFax", Content-Type: text/xml;charset=UTF-8, User-Agent: sfax-api gem 0.0.1
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:wsdl="http://tempuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ins0="http://tempuri.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <ins0:sendFax>
      <ins0:xDoc>
        <FaxRequest>
          <DocMerge>false</DocMerge>
          <RecipientFax>555.123.4567</RecipientFax>
          <Password>test</Password>
          <UserId>test</UserId>
          <image>PGh0bWw+PGJvZHk+VGVzdCBGYXg8L2JvZHk+PC9odG1sPg==</image>
          <DocType>html</DocType>
          <RecipientName>test</RecipientName>
        </FaxRequest>
      </ins0:xDoc>
    </ins0:sendFax>
  </env:Body>
</env:Envelope>

工作

SOAP request: https://faxregistration.com/SfaxWS/SfaxAPI.asmx
SOAPAction: "http://tempuri.org/sendFax", Content-Type: text/xml;charset=UTF-8, User-Agent: sfax-api gem 0.0.1
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <sendFax xmlns="http://tempuri.org/">
      <xDoc>
        <FaxRequest>
          <UserId>test</UserId>
          <Password>test</Password>
          <RecipientName>test</RecipientName>
          <RecipientFax>555.123.4567</RecipientFax>
          <DocType>html</DocType>
          <image>PGh0bWw+PGJvZHk+VGVzdCBGYXg8L2JvZHk+PC9odG1sPg==</image>
          <DocMerge>false</DocMerge>
        </FaxRequest>
      </xDoc>
    </sendFax>
  </soap:Body>
</soap:Envelope>

最佳答案

我注意到的第一件事是,您的请求的第一行是“不工作”示例中的 env:Envelope 和“工作”示例中的 soap:Envelope .

除此之外,该标签还缺少一些属性。它们可能很重要,但我认为是外部元素的命名导致了损坏。

关于ruby-on-rails - 这两个 SOAP 请求有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7183095/

相关文章:

java - 在java中转换ruby unpack等效项

Ruby Mail gem 提取 header 并清理正文

ruby-on-rails - Array.count with block 不返回正确答案

ruby-on-rails-3 - 如何让 resque-web 在 Heroku 上工作?

jquery - Rails 5 - 当前 ExecJS 运行时不支持 ES6。请安装最新的 Node.js

ruby-on-rails - 如何使用可变日期在 Rails 中搜索日期范围

mysql - 制作新的 Rails 应用程序时出错

javascript - try() activesupport 方法的 coffeescript 模拟

ruby-on-rails - Airbrake 和 Spree 商业 API : undefined method `airbrake_request_data`

Ruby Mongo 映射器包含 "abc"?