【问题标题】:Ruby SOAP SSL WoesRuby SOAP SSL 问题
【发布时间】:2008-10-14 01:04:21
【问题描述】:

我在 Ruby 中有一个 SOAP 客户端,我正在尝试使用 Ruby SOAP 服务器,但无济于事。客户端可以在 SSL 上使用 Python SOAP 服务器正常工作,但不能使用 Ruby 版本。这是服务器的样子:

require 'soap/rpc/standaloneServer'
require 'soap/rpc/driver'
require 'rubygems'
require 'httpclient'

def cert(filename)
  OpenSSL::X509::Certificate.new(File.open("path to cert.cert") { |f|
    f.read
  })
end

def key(filename)
  OpenSSL::PKey::RSA.new(File.open("path to rsaprivate.key") { |f|
    f.read
  })
end

class Server < SOAP::RPC::HTTPServer
 ~code snipped for readability~
end

server = Server.new(:BindAddress => HelperFunctions.local_ip, :Port => 1234, :SSLCertificate => cert("path to cert"), :SSLPrivateKey => key("path to rsa private key"))
new_thread = Thread.new { server.start }

为了便于阅读,我已经删减了一些代码(例如,我在其中公开了一些方法),并且在关闭 SSL 的情况下也能正常工作。但是当客户端尝试连接时,它会看到:

warning: peer certificate won't be verified in this SSL session
/usr/lib/ruby/1.8/net/http.rb:567: warning: using default DH parameters.
/usr/lib/ruby/1.8/net/http.rb:586:in `connect': unknown protocol (OpenSSL::SSL::SSLError)

我尝试从 this post 那里得到一些建议,现在我看到了这条消息:

/usr/lib/ruby/1.8/soap/httpconfigloader.rb:64:in `set_ssl_config': SSL not supported (NotImplementedError)

任何关于如何解决此问题的想法将不胜感激。

【问题讨论】:

  • 我遇到了同样的问题,但对于客户而言。我试过require 'webrick/https' 无济于事。您在客户端取得了成功吗?

标签: ruby soap ssl


【解决方案1】:

精氨酸。我试图跟随this link,结果发现我错过了一个简单的包含语句:

require 'webrick/https'

结合原始问题中链接的帮助可以解决问题。希望这可以为其他人节省一个小时的悲伤:)

【讨论】:

    【解决方案2】:

    “不支持 SSL”可能是由于没有安装 httpclient 造成的。

    【讨论】:

      【解决方案3】:

      我也是……别忘了把 :SSLEnable => true 花几个小时搞清楚……

      server = Server.new(:BindAddress => HelperFunctions.local_ip, :Port => 1234, :SSLEnable => true, :SSLCertificate => cert("path to cert"), :SSLPrivateKey => key("path to rsa private key"))
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-10-24
        • 1970-01-01
        • 1970-01-01
        • 2011-08-19
        • 1970-01-01
        相关资源
        最近更新 更多