Reputation: 2129
I'm having issues calling a 3rd party SOAP client and I'm not sure what to investigate next. I was given their certificate and key to authenticate with. Any advice is much appreciated.
The client is not a public CA, so the root certificate has to be added to our own list of trusted certificates. I just double clicked on the CRT file to add it on OSX.
client = Savon.client(
wsdl: '/path/to/wsdl.wsdl',
endpoint: "https://anotherendpoint.com", # we were asked to replace the endpoint in the WSDL with another one
ssl_cert: OpenSSL::X509::Certificate.new(File.read('/path/to/cert.crt')),
ssl_cert_key: OpenSSL::PKey::RSA.new(File.read('/path/to/key.key')),
ssl_cert_key_password: 'somePassword',
log_level: :debug,
log: true,
pretty_print_xml: true
)
client.call(:some_method, { ... })
The response is:
...
D, [2023-06-07T09:38:57.926769 #72531] DEBUG -- : HTTPI /peer POST request to anotherendpoint.com (httpclient)
HTTPClient::KeepAliveDisconnected: HTTPClient::KeepAliveDisconnected: Connection reset by peer
from /Users/xxx/.rbenv/versions/3.0.5/lib/ruby/gems/3.0.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:813:in `rescue in block in parse_header'
Caused by Errno::ECONNRESET: Connection reset by peer
from /Users/xxx/.rbenv/versions/3.0.5/lib/ruby/gems/3.0.0/gems/openssl-3.0.1/lib/openssl/buffering.rb:80:in `sysread'
Caused by HTTPClient::KeepAliveDisconnected: HTTPClient::KeepAliveDisconnected: Connection reset by peer
from /Users/xxx/.rbenv/versions/3.0.5/lib/ruby/gems/3.0.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:813:in `rescue in block in parse_header'
Caused by Errno::ECONNRESET: Connection reset by peer
from /Users/xxx/.rbenv/versions/3.0.5/lib/ruby/gems/3.0.0/gems/openssl-3.0.1/lib/openssl/buffering.rb:80:in `sysread'
The CRT file looks like this:
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 440 (0x1b8)
Signature Algorithm: sha256WithRSAEncryption
...
...
-----BEGIN CERTIFICATE-----
...base64 encoded block...
-----END CERTIFICATE-----
The private key file looks like this:
-----BEGIN PRIVATE KEY-----
...base64 encoded block...
-----END PRIVATE KEY-----
I was also given a .csr and .pfx file.
Edit: I realized I receive the same error when I comment out the certificates:
client = Savon.client(
wsdl: '/path/to/wsdl.wsdl',
endpoint: "https://anotherendpoint.com",
# ssl_cert: OpenSSL::X509::Certificate.new(File.read('/path/to/cert.crt')),
# ssl_cert_key: OpenSSL::PKey::RSA.new(File.read('/path/to/key.key')),
# ssl_cert_key_password: 'somePassword',
log_level: :debug,
log: true,
pretty_print_xml: true
)
client.call(:some_method, { ... })
Upvotes: 2
Views: 213