From: aastanti@... Date: 2005-04-05T23:59:43+09:00 Subject: [howto] pass a byte array to a web service Hello all, I have a web service developed in java with axis and I'd like to invoke it by means of SOAP4R. The problem is that I don't know how to pass an array of bytes, without starting from the WSDL. I tried with String#pack, an array with numbers or chars (ie: [121] or ['a'] or [65.chr]), but they all fail. On customer side I always get: SOAP::FaultError: java.lang.IllegalArgumentException: argument type mismatch from # Please consider that the argument is defined in wsdl as: ("x" is obviously a fake name) I tried simply with String as well, but I get: SOAP::FaultError: org.xml.sax.SAXException: Bad types (class java.lang.String -> class [B) from # We tried calling the web service in the following way: require 'soap/rpc/driver' s = SOAP::RPC::Driver.new('http://localhost:8080/fake/services/BigFake', 'http://www.fake.com/fake') s.add_method_with_soapaction("fakeMethod", 'http://localhost:8080/fake/services/BigFake/fakeMethod', ['in', 'x']) x = ['a'] p s.fakeMethod(x) Of course in reality we are calling a more complex method, with 8 input parameters, 1 output parameter and a return value, but we have problem only with the byte[] one. The equivalent java version (the one that works) is a lot more complex, hence it is not useful to post it here, but consider that the parameter is passed to an axis call client as a native byte[]. We have tried to invoke the web service starting from the WSDL, and surprisingly it works passing a String, which is not so understandable to me: require 'soap/wsdlDriver' WSDL_URL = "http://localhost:8080/fake/services/BigFake?wsdl" s = SOAP::WSDLDriverFactory.new(WSDL_URL).createDriver x = "abc" p s.fakeMethod(x) Why the latter works, but the former, even passing a String, doesn't work? Can anybody shed some light on this? TIA