Skip to content

Instantly share code, notes, and snippets.

@chrislerum
Forked from arieliten/api_test.rb
Created April 11, 2013 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrislerum/5365538 to your computer and use it in GitHub Desktop.
Save chrislerum/5365538 to your computer and use it in GitHub Desktop.
require 'rubygems'
gem 'savon', '=1.1.0'
require 'savon'
WSDL_URL = "https://testenv.w-w-i-s.com/hb/51/api.asmx?wsdl"
HMAC = 'string'
CLIENT_ID = 'AHHRV'
MAIN_HEADER = {
'Credentials' => {
'HMac' => HMAC,
'ClientID' => CLIENT_ID,
'UserName' => 'ariel1234',
'Password' => 'worldwide1'
}
}
puts "Testing connection to endpoint API: '#{WSDL_URL}' ..."
client = Savon.client do |wsdl, http|
wsdl.document = WSDL_URL
http.auth.ssl.verify_mode = :none
end
# Showing operations
operations = client.wsdl.soap_actions
puts "The operations available to call on this endpoint are:"
operations.each do |op|
puts "\t+ #{op}"
end
# === Get Accounts ===
# <soap:Envelope xmlns="http://www.w-w-i-s.com/hb/51"
# xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
# xmlns:xsd="http://www.w3.org/2001/XMLSchema"
# xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" >
# <soap:Header>
# <Credentials>
# <HMac>string</HMac>
# <ClientID>AHHRV</ClientID>
# <UserName>ariel1234</UserName>
# <Password>worldwide1</Password>
# <!--<SessionKey>3ucvciuejbtf1yeu4fpsnfuj</SessionKey>-->
# </Credentials>
# </soap:Header>
# <soap:Body>
# <GetAccounts>
# <accttype>All</accttype>
# <skiprefresh>false</skiprefresh>
# </GetAccounts>
# </soap:Body>
# </soap:Envelope>
body = {
'GetAccounts' => {
'accttype' => "All",
'skiprefresh' => 'false'
}
}
response = client.request :soap, :get_accounts do
soap.header = MAIN_HEADER
soap.body = body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment