I am working with a rails 5 application and using Savon (2.12.1) for making XML request. Lately I am observing HTTP::ConnectionError: couldn't read response headers while making the request via Savon. Ideally I was expecting rescuing Savon::Error will handle all network related issues like open_timeout and read_timeout.
My Savon implementation looks like below
options = {
wsdl: wsdl_url,
endpoint: wsdl_url + "/Secure/",
logger: ::Logger.new("log/my_soap.log"),
log: true,
log_level: :debug,
pretty_print_xml: false,
convert_request_keys_to: :none,
use_wsa_headers: true,
soap_version: 2,
element_form_default: :qualified,
open_timeout: 50,
read_timeout: 50
}
savon_client = Savon.client(options)
begin
response = savon_client.call(method, message: args, headers: { 'content-type' => 'application/soap+xml;charset=UTF-8;action="' + savon_client.wsdl.soap_action(method) + '"' })
rescue Savon::Error => error
# log and report errors
end
Do I need to rescue HTTP::ConnectionError additionally? And I am little confused with the error message couldn't read response headers, does this means request reached the 3rd party service or it failed to establish a connection?