Savon SSL Issue

5.9k Views Asked by At

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
3

There are 3 best solutions below

0
CambridgeMike On

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..

0
ihoka On

There is a bug in Ruby's net/http handling of the SSL handshake.

Try forcing the SSL version to get around the bug:

client.http.auth.ssl.sock.ssl_version="SSLv3"
0
Luca Arcara On

Savon 2.x support ssl global option:

Savon.client(ssl_verify_mode: :none)

and

Savon.client(ssl_version: :SSLv3)