Created
June 6, 2010 20:08
-
-
Save rubiii/427849 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
# rubygems.org/gems/savon by examples | |
# overview of examples at: http://gist.github.com/gists/427837 | |
require "savon" | |
# HTTP basic authentication | |
client = Savon::Client.new do | |
wsdl.location = "http://users.example.com?wsdl" | |
request.basic_auth "username", "password" | |
end | |
# NTLM authentication | |
client = Savon::Client.new do | |
wsdl.location = "http://users.example.com?wsdl" | |
request.ntlm_auth "username", "password" | |
end | |
# WSSE authentication | |
client = Savon::Client.new do | |
wsdl.location = "http://users.example.com?wsdl" | |
wsse.credentials "username", "password" | |
end | |
# WSSE digest authentication | |
client = Savon::Client.new do | |
wsdl.location = "http://users.example.com?wsdl" | |
wsse.credentials "username", "password" | |
wsse.digest = true | |
end | |
# SSL client authentication | |
client = Savon::Client.new do | |
wsdl.location = "http://users.example.com?wsdl" | |
request.http.ssl_client_auth( | |
:cert => OpenSSL::X509::Certificate.new(File.read("client_cert.pem")), | |
:key => OpenSSL::PKey::RSA.new(File.read("client_key.pem"), "password if one exists"), | |
:ca_file => "cacert.pem", | |
:verify_mode => OpenSSL::SSL::VERIFY_PEER | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment