I have a SOAP client in Ruby that I’m trying to get working with a Ruby SOAP server, to no avail. The client works fine over SSL with a Python SOAP server, but not with the Ruby version. Here’s what the server looks like:
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 }
I’ve trimmed some of the code out for readability’s sake (e.g., I have some methods in there I expose) and it works fine with SSL off. But when the client tries to connect, it sees this:
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)
I tried taking some advice from this post and now I see this message:
/usr/lib/ruby/1.8/soap/httpconfigloader.rb:64:in `set_ssl_config': SSL not supported (NotImplementedError)
Any ideas on how to fix this would be greatly appreciated.
Arg. I was trying to follow along this link and it turns out I was missing a simple include statement:
That, combined with the help from the link in the original question solves the problem. Hopefully this saves someone else down the line an hour of grief 🙂