Savon SSL 问题
我正在努力让 Savon gem 连接到我们的一台服务器。我不断收到错误消息,指出我无法通过 ssl。我读过很多教程和修复程序,但似乎都不起作用。
任何帮助表示赞赏 - 如果我能克服它,这将成为我的星期一:-)。
错误:
D, [2011-06-20T09:43:02.002993 #10328] DEBUG -- : Retrieving WSDL from: http://path_to_wsdl:4443/sm/services/mailing/2009/03/02?wsdl
D, [2011-06-20T09:43:02.129057 #10328] DEBUG -- : HTTPI executes HTTP GET using the httpclient adapter
/.rvm/gems/ruby-1.9.2-p0/gems/httpclient-2.2.1/lib/httpclient/session.rb:276:in `connect': SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert unexpected message (OpenSSL::SSL::SSLError)
我的代码:
require 'savon'
client = Savon::Client.new "path_to_my_wsdl"
client.http.auth.ssl.cert_file = "path/cert.pem"
client.http.auth.ssl.cert_key_file = "/path/localhost.key"
client.http.auth.ssl.verify_mode = :none
client.wsse.credentials "username", "password"
client.wsdl.soap_actions
I'm struggling to get the Savon gem to connect to one of our servers. I keep getting an error stating I can't get past the ssl. I've read numerous tutorials and fixes but none seem to work.
Any help appreciated - this will make my Monday if I can get past it :-).
Error:
D, [2011-06-20T09:43:02.002993 #10328] DEBUG -- : Retrieving WSDL from: http://path_to_wsdl:4443/sm/services/mailing/2009/03/02?wsdl
D, [2011-06-20T09:43:02.129057 #10328] DEBUG -- : HTTPI executes HTTP GET using the httpclient adapter
/.rvm/gems/ruby-1.9.2-p0/gems/httpclient-2.2.1/lib/httpclient/session.rb:276:in `connect': SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert unexpected message (OpenSSL::SSL::SSLError)
My code:
require 'savon'
client = Savon::Client.new "path_to_my_wsdl"
client.http.auth.ssl.cert_file = "path/cert.pem"
client.http.auth.ssl.cert_key_file = "/path/localhost.key"
client.http.auth.ssl.verify_mode = :none
client.wsse.credentials "username", "password"
client.wsdl.soap_actions
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Savon 2.x 支持 ssl 全局选项:
和
Savon 2.x support ssl global option:
and
不确定您是否已经这样做了,但是当我必须在项目中使用 Savon 时,我发现它非常有用,可以确保 Soap 服务器按照我认为与 SoapUI 一起工作的方式工作(http://www.eviware.com/) 。然后您可以输出两者的 SOAP 请求并进行比较。
Not sure if you did this already, but when I had to use Savon for a project I found it incredibly useful to make sure the Soap server was working as I thought it should with SoapUI (http://www.eviware.com/). You can then output the SOAP request from the two and compare..
Ruby 的 net/http 处理 SSL 握手时存在一个 bug。
尝试强制使用 SSL 版本来绕过该错误:
There is a bug in Ruby's net/http handling of the SSL handshake.
Try forcing the SSL version to get around the bug: