Skip to content

Instantly share code, notes, and snippets.

@shaneog
Created September 13, 2012 15:08
Show Gist options
  • Save shaneog/3714955 to your computer and use it in GitHub Desktop.
Save shaneog/3714955 to your computer and use it in GitHub Desktop.
require 'savon'
HTTPI.log = false
username = "XXXXXXX"
password = "XXXXXXX"
Savon.configure do |config|
# The XML logged by Savon can be formatted for debugging purposes.
# Unfortunately, this feature comes with a performance and is not
# recommended for production environments.
config.pretty_print_xml = true
# Savon raises SOAP and HTTP errors, but you can disabling this behavior.
config.raise_errors = true
# The XML namespace identifier used for the SOAP envelope defaults to :env
# but can be configured to use a different identifier. If you need this
# feature, please open a ticket because Savon should figure out the
# namespace and identifier itself.
config.env_namespace = :s
end
client = Savon::Client.new do
wsdl.document = "http://services.carsolize.com/BookingServices/dynamicdataservice.svc?wsdl"
#wsdl.endpoint = "https://services.carsolize.com/BookingServices/dynamicdataservice.svc"
#wsdl.namespace = ""
#http.headers = { "Accept-Encoding" => "gzip, deflate", "Connection" => "Keep-Alive" }
end
response = client.request "ServiceRequest", "xmlns" => "http://tempuri.org/" do |soap, wsdl|
client.http.headers["SOAPAction"] = '"http://tempuri.org/IDynamicDataService/ServiceRequest"'
soap.body = {
"rqst" => {
"Credentials" => {
"UserName" => username,
"Password" => password
},
"RequestType" => "Login",
"TypeOfService" => "Unknown",
},
}
end
p response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment