-
-
Save drymar/1a37798a03fbf88fe94d6f9e5be603d9 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