String.getBytes()?
On 08/03/06, Plorks mail <[EMAIL PROTECTED]> wrote:
>
>
> i have these methods
>
> public static byte[] compress(String string) throws IOException
> {
> ...
> byte[] compressedData = bos.toByteArray();
> return compressedData
> }
>
>
> public static String unCompress(byte [] bytes)
> {
> ...
> byte[] decompressedData = bos.toByteArray();
> String uncompressed = new String(decompressedData);
> return uncompressed;
> }
>
> Created a webservice in the wsdl i have this
> ...
>
> - <element name="compressResponse">
> - <complexType>
> - <sequence>
> <element name="compressReturn" type="xsd:base64Binary" />
> </sequence>
> </complexType>
> </element>
>
> ...
>
>
> when i call the WS i get a null value
>
> Service service = new Service();
>
> Call call = (Call) service.createCall();
>
> call.setTargetEndpointAddress(endpoint);
>
> call.setOperationName("squashString");
>
> byte[] bytes = (byte[]) call.invoke(new Object[] {uncompressed});
>
>
> but if i do this (call.invoke(new Object[] {uncompressed})) and inspect the
> result i get what i expect
>
>
> if i do this System.out.println(call.invoke(new Object[]
> {uncompressed}).getClass());
>
> is comes back as class java.lang.String
>
> i need to return a byte[] from the call. i need to use the byte [] in the
> next call unCompress
>
> can someone show me how i convert a string to a byte[] so i can use it in
> the next method
>
> Can anyone help me out as i'm a bit stuck
>
> many thanks
>
> _________________________________________________________________
> The new MSN Search Toolbar now includes Desktop search!
> http://toolbar.msn.co.uk/
>
>