i've written a class with 2 methods in it compress and uncompress and i've used the examples from java almanac


http://javaalmanac.com/egs/java.util.zip/CompArray.html

and

http://javaalmanac.com/egs/java.util.zip/DecompArray.html


I've then done java2wsdl to create the wsdl file


Now i'm trying to cal lthe 2 methods using the web service

To call the compress method i'm just using this

String uncompressed = "some string in here to compress";

Service service = new Service();

Call call = (Call) service.createCall();

call.setTargetEndpointAddress(endpoint);

call.setOperationName("compress");

byte[] a = ((String)call.invoke(new Object[] {uncompressed})).getBytes();



Then i'm using 'a' to pass to the uncompress method like this

Service service1 = new Service();

Call call1 = (Call) service1.createCall();

call1.setTargetEndpointAddress(endpoint);

call1.setOperationName("uncompress");

String st = (String) call1.invoke(new Object[] {a});


But the 2nd call just hangs




<element name="compress">
   <complexType>
    <sequence>
     <element name="string" type="xsd:string"/>
    </sequence>
   </complexType>
  </element>
  <element name="compressResponse">
   <complexType>
    <sequence>
     <element name="compressReturn" type="xsd:base64Binary"/>
    </sequence>
   </complexType>
  </element>
  <element name="uncompress">
   <complexType>
    <sequence>
     <element name="bytes" type="xsd:base64Binary"/>
    </sequence>
   </complexType>
  </element>
  <element name="uncompressResponse">
   <complexType>
    <sequence>
     <element name="uncompressReturn" type="xsd:string"/>
    </sequence>
   </complexType>
  </element>

thanks for any help



From: robert <[EMAIL PROTECTED]>
Reply-To: axis-user@ws.apache.org
To: axis-user@ws.apache.org
Subject: Re: help with byte[]
Date: Wed, 8 Mar 2006 15:33:55 -0300

I'm having a hard time following what you're trying to do. You could try:

1) Showing the entire wsdl.
2) List the steps of execution, ie, compressing / uncompressing, order of web
services calls etc.

Are you using the code from the java almanac I posted a few days ago?

Lastly, if the call is hanging, try putting the soap monitor or tcpmon on the
client / server to see where it hangs. Also try turning on logging on the
client and server side.

HTH,
Robert
http://www.braziloutsource.com/

Em Quarta 08 Março 2006 14:14, o Plorks mail escreveu:
> i've tried that
>
> byte [] a = ((String) call.invoke(new Object[] {uncompressed})).getBytes();
>
> but when i use a in the next call it just hangs
>
> String st = (String) call1.invoke(new Object[] {a});
>
> >From: Michael <[EMAIL PROTECTED]>
> >Reply-To: axis-user@ws.apache.org
> >To: axis-user@ws.apache.org
> >Subject: Re: help with byte[]
> >Date: Wed, 8 Mar 2006 17:07:35 +0000
> >
> >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/
>
> _________________________________________________________________
> Are you using the latest version of MSN Messenger? Download MSN Messenger
> 7.5 today! http://messenger.msn.co.uk

--

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! http://www.msn.co.uk/newsletters

Reply via email to