加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Rails 3.1 Savon soap请求给出超时::错误:超

发布时间:2020-12-17 04:32:37 所属栏目:百科 来源:网络整理
导读:我在使用rails 3.1中的savon构建soap客户端时遇到了麻烦.但是当我尝试从curl命令行发出请求时,我能够成功获得响应. 我从命令行的curl请求看起来像这样 curl -d @Downloads/test.xml -H "content-type: text/xml;charset=UTF-8" -H "SOAPAction: http://servi
我在使用rails 3.1中的savon构建soap客户端时遇到了麻烦.但是当我尝试从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" }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读