Last active
May 4, 2018 12:41
-
-
Save altherlex/4abaeee46cc421ca24a8 to your computer and use it in GitHub Desktop.
How to consuming a Qualitor WebService
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
# 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