ruby-on-rails - Rails 3.1 Savon soap 请求给出 Timeout::Error: Timeout::Error ut using curl 我得到响应

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

我在 Rails 3.1 中使用 savon 构建肥皂客户端时遇到了麻烦。但是当我尝试从 curl 命令行发出请求时,我能够成功获得响应。
我来自命令行的 curl 请求如下所示

curl -d @Downloads/test.xml  -H "content-type: text/xml;charset=UTF-8" -H "SOAPAction: http://services.bamnetworks.com/registration/identityPoint/create" "https://qaservices.bamnetworks.com/ws/services/IdentityPointService" -v

从中我得到了这样一个完美的回应。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header /><soapenv:Body><identityPoint_create_response xmlns="http://services.bamnetworks.com/registration/types/1.6"><status><code>-2000</code><message> [Duplicate credential constraint violated] [com.bamnetworks.registration.types.exception.DuplicateCredentialException]</message><exceptionClass>com.bamnetworks.registration.types.exception.DuplicateCredentialException</exceptionClass>

但是当我每次收到 Savon 客户的请求时
HTTPI executes HTTP POST using the net_http adapter
Timeout::Error: Timeout::Error

我的 Savon 请求看起来像这样
client = Savon::Client.new do |wsdl, http|
  http.auth.ssl.verify_mode = :none
  wsdl.document = "https://qaservices.bamnetworks.com/ws/services/IdentityPointService?wsdl"
end

begin

response = client.request :ns, :identityPoint_create_request do |soap, wsdl, http|

      http.headers['SOAPAction'] = 'http://services.bamnetworks.com/registration/identityPoint/create'
      http.headers = { "Content-Length" => "0", "Connection" => "Keep-Alive" }
      soap.namespaces["xmlns:ns0"]="http://services.bamnetworks.com/application/types/1.0"

      soap.header = {
          "ns0:appCredentials" => {
              "ns0:name"=>"XXXXXXX",
              "ns0:password"=>"XXXXXXXXX"
          }
      }
      soap.body ={
          :identification => {
              :email => {
                  :address => "mlb_user@mlb.com"
              },
              :password => { :address => { :id => 44 } }
          },
          :profileProperty => {

              :name => "birthDay",
              :value => "17"
          },
          :profileProperty =>     {
              :name => "birthMonth",
              :value => "8"
          },
          :profileProperty =>     {
              :name => "birthYear",
              :value => "1986"
          },
          :attributes! => { :identification => { :type => "email-password" } }
      }
    end

我不知道我在哪里犯了错误。如果有人帮我解决这个问题。
谢谢!

最佳答案

这可能是肥皂服务器问题尝试评论行:

http.headers = { "Content-Length" => "0", "Connection" => "Keep-Alive" }

关于ruby-on-rails - Rails 3.1 Savon soap 请求给出 Timeout::Error: Timeout::Error ut using curl 我得到响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11259917/

相关文章:

ruby-on-rails - 为什么 rbenv 在 Mac OS Catalina 上不起作用

ruby-on-rails - Rails has_many 元数据

ruby-on-rails - 在 Rails 中创建自定义方法

ruby-on-rails - Rails 3.1 部署到 Heroku 错误

rails 3.1.0 和 ruby​​ 1.9.2 中的 javascript 运行时。无法处理 heroku。什么都做了,还是不行

ruby-on-rails - 如何在 Rails 3.2.1 中使用特定于 Controller 的样式表?

jquery - 具有 Assets 的 Rails gem 不会添加到 config.assets.paths

ruby-on-rails - 当我们需要使用 bundle :lock and unlock on rails3

ruby-on-rails - Rails - 具有多种值(value)类型的 EAV 模型?

internationalization - 导轨 I18n : can't override "1 error prohibited this packet from being saved:"