Created
August 29, 2013 14:24
-
-
Save x2q/6378774 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -w | |
require 'net/http' | |
require 'net/https' | |
require 'openssl' | |
require 'uri' | |
DIR = File.dirname(__FILE__) | |
uri = URI.parse("https://test.directory.securecode.com:443/") | |
https = Net::HTTP.new(uri.host, uri.port) | |
https.cert = OpenSSL::X509::Certificate.new(File.read("#{DIR}/28143-VALFAC-MPIclient.crt")) | |
https.key = OpenSSL::PKey::RSA.new(File.read("#{DIR}/28143-VALFAC-MPIclient.key")) | |
https.ca_file = "#{DIR}/VALFAC-trustedroot.pem" | |
https.use_ssl = true | |
https.read_timeout = 30 | |
#raise 'certificate can not be verified' unless https.cert.verify https.key | |
req = Net::HTTP::Post.new(uri.request_uri) | |
req.body = File.read("#{DIR}/vereq.xml") | |
req.content_type = 'application/x-www-form-urlencoded' | |
res = https.request(req) | |
p res.body | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment