I’m trying to call a webservice function which has an array of
parameters as input. The webservice documentation says to send input:
Unit.parameter[0].name
Unit.parameter[0].value
Unit.parameter[1].name
Unit.parameter[1].value
But it doesn’t work with the hash I build and it seems the parameters
are ignored: (BTW, is there anyway to see the generated xml request?)
require ‘soap/rpc/driver’
factory = SOAP::WSDLDriverFactory.new(url)
driver = factory.create_rpc_driver()
unit = { :parameter => [ {:name => ‘name1’, :value => ‘value1’}, {:name
=> ‘name2’, :value => ‘value2’} ] }
result = driver.getUnits( :unit => unit )
Is something wrong with this syntax? (Or bug in ruby SOAP?)
I get expected result when sending raw XML request using SoapUI
(www.soapui.org) tool to test web service, so it’s OK. I also tried
declaring ruby hash with same structure as XML ( i.e. style like
:parameters => { :parameterArray => { :item => ), but same result. I can
do it with XML request, but I’m not able to call it using Ruby SOAP
libraries for functions with array input (all other functions works
fine). Can someone please help?
Here is relevant declarations from webservice WSDL:
<wsdl:message name=“getUnitsRequest”>
<wsdl:part element=“impl:GetUnitsRequest” name=“GetUnitsRequest”/>
</wsdl:message>