Skip to content

Instantly share code, notes, and snippets.

@tanelsuurhans
Created September 6, 2016 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanelsuurhans/0dad297fea53be4dcdc64e06d55ea0c6 to your computer and use it in GitHub Desktop.
Save tanelsuurhans/0dad297fea53be4dcdc64e06d55ea0c6 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'net/http'
require 'net/https'
require 'openssl'
require 'uri'
endpoint = URI.parse("...")
request = Net::HTTP::Post.new(endpoint.path)
https = Net::HTTP.new(endpoint.host, endpoint.port)
https.use_ssl = true
https.cert = OpenSSL::X509::Certificate.new(File.read("<path>/soap.crt"))
https.key = OpenSSL::PKey::RSA.new(File.read("<path>/soap.key"))
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
https.ca_file = "<path>/chain.crt"
puts https.start { |cx| cx.request(request) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment