I think I have read all topics related to this subject, but still no solution. I am using:
- RubyMine 2017.2.4
- Ruby 2.4.1
- Rails 5.1.0
- Savon
When I connect in my rails console with Savon to a server, I get the following error:
Errno::ECONNRESET: An existing connection was forcibly closed by the remote host. - SSL_connect
This is the code I use:
wsdlUrl = 'https://some.server.com/ws/schema/Echo.wsdl'
licenseKey = '1234567890'
client = Savon.client(wsdl: wsdlUrl,
log:true,
ssl_verify_mode: :none)
response = client.call(:echo,
message: { licenseKey: licenseKey,
value: 'Hello World'})
puts "\nResult \"#{response.body[:echo_response][:value]}\" was returned"
I have tried to following:
- Download the ca-bundle.crt and added to my system environment (and restart
everything) - Updated my gems
- Reinstall Ruby, Rails and RubyMine
- Created a new app and copied code
- added "require openssl" to the code
added the following code:
require 'open-uri' require 'net/https' module Net class HTTP alias_method :original_use_ssl=, :use_ssl= def use_ssl=(flag) path = ( Rails.env == "development") ? "lib/ca-bundle.crt" : "/usr/lib/ssl/certs/ca-certificates.crt" self.ca_file = Rails.root.join(path).to_s self.verify_mode = OpenSSL::SSL::VERIFY_PEER self.original_use_ssl = flag end end end
Just nothing is working anymore.
The strange this is this:
When I run the rails (development) console, and I enter the code above I get the ssl_connect error. When I change some code in RubyMine, and DON'T restart the console, I won't get any errors. When I rerun the Rails Console, I get the ssl-connect error again.
Does anyone know where I can look
EDIT 1: I found out that if I put above code in a document (echo.rb) it will work when I call the document in the terminal as: ruby echo.rb