From: "NAKAMURA, Hiroshi" Date: 2004-03-18T11:18:31+09:00 Subject: Re: Using Hash parameters in SOAP calls Hi, > From: "Christian Pekeler" > Newsgroups: comp.lang.ruby > Sent: Thursday, March 18, 2004 1:54 AM > I can't seem to figure out how to pass a Hash to a webservice > function. This is what I'm doing: > > require "soap/wsdlDriver" > wsdl = "http://localhost:8888/cgi-bin/WebObjects/Interview.woa/ws/WebServices?wsdl" > factory = SOAP::WSDLDriverFactory.new(wsdl) > @driver = factory.createDriver > > @driver.someWebserviceFunctionWithStringAndNumber("blah", 55) > @driver.someWebserviceFunctionWithHash({"key1" => "value1", "key2" => > "value2"}) > > someWebserviceFunctionWithStringAndNumber works fine, > someWebserviceFunctionWithHash throws up with [snip] It's a bug of SOAP4R. Serializing Hash (aka ApacheMap in SOAP world) using WSDL fails. Thank you for finding it. I'll look into this and fix. For workaround, it might work. require "soap/wsdlDriver" wsdl = "..." driver = SOAP::WSDLDriverFactory.new(wsdl).create_driver driver.someWebserviceFunctionWithStringAndNumber("blah", 55) backup = driver.wsdl_mapping_registry driver.wsdl_mapping_registry = SOAP::Mapping::DefaultRegistry driver.someWebserviceFunctionWithHash({"key1" => "value1", "key2" => "value2"}) driver.wsdl_mapping_registry = backup (calling other methods...) MappingRegistry generated from WSDL does not support ApacheMap even if the WSDL includes ApacheMap definition for now. So I use default MappingRegistry here. With default MappingRegistry, driver cannot understand user defined types in WSDL so it could not work... For example, it will crash if resulting value of someWebserviceFunctionWithHash includes user defined type in WSDL. Regards, // NaHi