Skip to content

Instantly share code, notes, and snippets.

@altherlex
Last active May 4, 2018 12:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save altherlex/4abaeee46cc421ca24a8 to your computer and use it in GitHub Desktop.
Save altherlex/4abaeee46cc421ca24a8 to your computer and use it in GitHub Desktop.
How to consuming a Qualitor WebService
# Calling into cmd line (ShellScipt or PowerShell):
# ./clisoap-qualitor.rb config-file.yml
require 'savon'
require 'yaml'
config = YAML::load( File.open(ARGV[0]) )
conn = Savon.client(wsdl:config["url"])
auth = conn.call(:login, message:{login:config["login"], passwd:config["passwd"], company:config["company"]})
# TIP: HOW TO KEEP SESSION WHEN CONSUMING A SOAPCLIENT WITH SAVON v.2
# It's necessary to maintain the session with option: "cookies:auth.http.cookies"
r = conn.call(config["method"].to_sym, message: {auth:auth.body[:login_response][:result], xmlValue:config["xml"]}, cookies:auth.http.cookies)
puts r.body
##### Exemple config-file.yml #####
url: http://youcompany.qualitor.com/ws/services/service.php?wsdl=WSTicket
login: user
passwd: 123
company: 1
method: close_ticket
xml: <wsqualitor><contents><data><cdchamado>126648</cdchamado><idfecharrelacionados>Y</idfecharrelacionados></data></contents></wsqualitor>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment