From: "NAKAMURA, Hiroshi" Date: 2005-04-16T08:07:41+09:00 Subject: Re: pass a byte array to a web service --------------enigBBA4C92B4239D3F5723F36A9 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hello, Sorry for the late reply. aa wrote: > Ok, I have used an HTTP monitor to check what's going on. The result is= > that working with SOAP::RPC::Driver and add_method_with_soapaction a > type is automatically attached to every parameter. Infact, in the SOAP > message I see: > YWJj > while using WSDLDriverFactory: > YWJj >=20 > That's it! Of course needs to be compatible with a byte[], that is to > say that if a type is specified it better be xsd:base64Binary. Infact, [snip] > Now the question is: why add_method_with_soapaction causes (sometimes > erronous) types to be passed with SOAP parameters? That's because without WSDL information, a driver cannot know the defined type of passing parameters. To specify its type directly at runtime, you can use SOAP/OM layer object (SOAP::*) such as; def test_echoBase64_xsd_base64Binary log_test str =3D "Hello (=C6=FC=CB=DC=9E=ECJapanese) =80=B3=80=F3=80=CB=80=C1=80= =CF" arg =3D SOAP::SOAPBase64.new(str) arg.as_xsd # Force xsd:base64Binary instead of soap-enc:base64= var =3D drv.echoBase64(arg) assert_equal(str, var) end def test_echoBase64_SOAP_ENC_base64 log_test str =3D "Hello (=C6=FC=CB=DC=9E=ECJapanese) =80=B3=80=F3=80=CB=80=C1=80= =CF" arg =3D SOAP::SOAPBase64.new(str) var =3D drv.echoBase64(arg) assert_equal(str, var) end (excerpted from http://dev.ctor.org/soap4r/file/trunk/test/interopR2/client.rb) You WSDL seems to define the parameter as xsd:base64Binary, so use the former one. There's also another solution. To escape from this kind of Ruby <-(SOAP)-> Java type mapping problem, you can let Java module to inference its type by removing type attribute for each element, if the Java side is utilizing a WSDL. drv.generate_explicit_type =3D false As a fact, your WSDLDriver sample does it implicitly. Regards, // NaHi --------------enigBBA4C92B4239D3F5723F36A9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Cygwin) iD8DBQFCYEkIf6b33ts2dPkRAtWyAJ0d4uYIf+cu6QnFf/MJeXuZwCIxhQCglrpu wTmVlM5xSLd9590xKZr48ho= =hWwf -----END PGP SIGNATURE----- --------------enigBBA4C92B4239D3F5723F36A9--