shared items

Thursday, April 9, 2009


1. Download soap4r from SVN.
svn co soap4r
This will result in two files being downloaded - wsdl2ruby.rb and
xsd2ruby.rb. The one I used was the wsdl2ruby.rb.
2. Generate sample SOAP client file
ruby wsdl2ruby.rb --wsdl http://location_of_WSDL --type client
This will result in the creation of three files - default.rb,
defaultDriver.rb and WSClient.rb. The sample client file is
WSClient.rb. Inside this file, I found all the remote methods and "nil"
arguments being passed to them. For e.g., I had a remote method defined
as follows in my web-service:
string observe (string req_id, string[] names, string[] values);
The second and third argument for this file were vectors of strings.
In the ruby client file, this method was exposed as follows:
obj =
parameters = nil
puts obj.observe(parameters)
So, even though my remote method should have three arguments, here
there is only one. According to nahi's email, I needed to construct a
hash table and pass that as the single argument.
3. Pass actual arguments.
name = ['CENTER', 'SPAN', 'SCALE', 'YREF', 'INTERVAL']
val = ['5.18 GHz', '2.95 MHz', '4.00', '-68.70', '30000']
parameters = {
'req_id' => '1',
'names' => {:string => name},
'values' => {:string => val}

result = obj.observe(parameters)
puts result.inspect

No comments: