我怎样才能让Ruby的SOAP RPC ::驱动程序::工作自签名的证书?(How can I ma

2019-09-24 02:11发布

我怎样才能做一个SOAP调用到使用自签名证书的服务器时,为防止这种异常?

require "rubygems"
gem "httpclient", "2.1.2"
require 'http-access2'
require 'soap/rpc/driver'
client = SOAP::RPC::Driver.new( url, 'http://removed' )
client.options[ 'protocol.http.ssl_config.verify_mode' ] = OpenSSL::SSL::VERIFY_NONE
client.options[ 'protocol.http.basic_auth' ] << [ url, user, pass ]

at depth 0 - 18: self signed certificate
/opt/local/lib/ruby/1.8/soap/streamHandler.rb:200:in `send_post': 415:  (SOAP::HTTPStreamError)
    from /opt/local/lib/ruby/1.8/soap/streamHandler.rb:109:in `send'
    from /opt/local/lib/ruby/1.8/soap/rpc/proxy.rb:170:in `route'
    from /opt/local/lib/ruby/1.8/soap/rpc/proxy.rb:141:in `call'
    from /opt/local/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call'

Answer 1:

尝试:

client.options["protocol.http.ssl_config.verify_mode"] = nil 


文章来源: How can I make Ruby's SOAP::RPC::Driver work with self signed certificates?
标签: ruby soap ssl