1 Replies - 9327 Views - Last Post: 02 June 2012 - 04:09 AM Rate Topic: -----

#1 Manojkarthik  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-April 12

error in calling wsdl file from ruby

Posted 19 April 2012 - 08:56 PM

require 'rubygems'
#require 'soap4r'
require 'http-access2'
require 'soap/rpc/driver'
require 'soap/rpc/driver'
require 'net/http'
url ="http://online.mccolls.com.au:8080/wsa/wsa1/wsdl?targetURI=urn:OHWebServiceFMGT"
soap = SOAP::RPC::Driver.new(url,"urn:OHWebServiceFMGT")
soap.wiredump_dev = STDERR
soap.options["protocol.http.ssl_config.verify_mode"] =
puts soap.getEmployeeFmgtDetails('02385')

Hitting error throws like this.

cacerts: C:/RhoStudio/ruby/lib/ruby/site_ruby/1.8/httpclient/cacert.p7s loading

from C:/RhoStudio/ruby/lib/ruby/1.8/soap/streamHandler.rb:170:in `send_p
from C:/RhoStudio/ruby/lib/ruby/1.8/soap/streamHandler.rb:109:in `send'
from C:/RhoStudio/ruby/lib/ruby/1.8/soap/rpc/proxy.rb:170:in `route'
from C:/RhoStudio/ruby/lib/ruby/1.8/soap/rpc/proxy.rb:141:in `call'
from C:/RhoStudio/ruby/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call'
from C:/RhoStudio/ruby/lib/ruby/1.8/soap/rpc/driver.rb:232:in `getEmploy
from FinalFri.rb:14

Is This A Good Question/Topic? 0
  • +

Replies To: error in calling wsdl file from ruby

#2 EdwinNameless  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 128
  • View blog
  • Posts: 723
  • Joined: 15-October 09

Re: error in calling wsdl file from ruby

Posted 02 June 2012 - 04:09 AM

I have always had issues doing SOAP requests with soap4r, especially when dealing with namespaces – and by the looks of it, you seem to have been playing with different alternatives yourself!

I usually use Savon for SOAP requests, partly because of its better namespace support, but also because the API is much nicer to use.

For the service you are trying to call, first install savon (gem install savon), and then the code translates as follows:

require 'rubygems'
require 'savon'
require 'pp'

# Prevent any logging
HTTPI.log = false
Savon.configure do |config|
  config.log = false
  config.log_level = :fatal

# Connect to the WSDL and instantiate the client
client = Savon::Client.new("http://online.mccolls.com.au:8080/wsa/wsa1/wsdl?targetURI=urn:OHWebServiceFMGT")

# Do the actual query, passing the employee code
response = client.request(:ins1, :get_employee_fmgt_details) do
  soap.body = { :pcEmployeeCode => '02385' }

# Pretty print the response, and get to the payload in the hash
pp response.to_hash[:get_employee_fmgt_details_response][:ph_ds][:ds_fmgt_details][:tt_fmgt_details]

This post has been edited by EdwinNameless: 02 June 2012 - 04:13 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1