【发布时间】: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'无济于事。您在客户端取得了成功吗?