Created
March 19, 2012 14:45
-
-
Save hoverlover/2114841 to your computer and use it in GitHub Desktop.
Using my forks of Akami and Savon to sign a request with a X.509 certificate. See https://github.com/genuitytech/akami and https://github.com/genuitytech/savon.
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
client = Savon::Client.new do | |
# This can be a URL also | |
wsdl.document = "/Path/to/your.wsdl" | |
# These are optional, only if your WSDL sucks :) | |
wsdl.endpoint = "https://your_endpoint" | |
wsdl.namespace = "http://your_namespace" | |
certs = Akami::WSSE::Certs.new :cert_file => "/path/to/cert.crt", :private_key_file => "/path/to/private/key.pem", :private_key_password => "password" | |
wsse.sign_with = Akami::WSSE::Signature.new certs | |
# SSL certs, if you need them | |
http.auth.ssl.tap do |ssl| | |
ssl.cert_file = "/path/to/signing/cert.crt" | |
ssl.cert_key_file = "/path/to/signing/private.key" | |
ssl.cert_key_password = "password" | |
ssl.ca_cert_file = "/path/to/signing/ca.crt" | |
end | |
end | |
# soap_action is optional | |
res = client.request :namespace_identifier, :element, soap_action: :action do | |
soap.element_form_default = :qualified | |
soap.body = { | |
element1: 'foo', | |
element2: 'bar' | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment