axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Beahm <dbe...@mihp.com>
Subject Re: Passing Arrays
Date Wed, 07 Jul 2004 20:56:47 GMT
Answering my own question:

The reason everyone finds this so simple is that it is -- but sticking 
to the user guide's sample code can trip you up.  I could not figure
out what values to enter for the two lines (below) that are commented
out.  As you probably already know, they are optional statements.  I've 
wasted more time than I want to think about on this tiny detail, and am 
posting this source code so that it can be in the archives.  Now I am 
finally getting started.

client method:
     Service  service = new Service();
     Call     call    = (Call) service.createCall();
     call.setTargetEndpointAddress( new
java.net.URL("http://localhost:8080/axis/wstest.jws"));
     call.setOperationName("test_strings");
     //call.addParameter("op1", XMLType.SOAP_ARRAY, ParameterMode.IN);
     //call.setReturnType( XMLType.SOAP_ARRAY);
     String[] foos = new String[9];
     foos[0] = "zero";
     foos[1] = "one";
     String[] a = (String[]) call.invoke( new Object [] {foos});
     System.out.println("Returned: '" + a[8] + "'");

server method:
   public String[] test_strings(String[] in)
   {
     String []ret = new String[in.length];
     for(int i=0; i < in.length; ++i)
     {
       ret[i] = in[in.length - (i + 1)];
     }
     return ret;		// return the array in reverse order
   }



David Beahm wrote:

> I'd love to know just a little bit more (assuming I'm not wildly off 
> course).  On the server side, I have set up a method to return a value 
> of type String[] and accept one parameter of type String[], but on the 
> client side I don't know what type (QName) to use - XMLType.________? Or 
> should I be using an altogether different method, such as 
> Document/Wrapped/Message service style, etc.?
> 




-- 
-----------------------------------------------------------------------
This email is confidential and intended solely for the use of the individual
to whom it is addressed. If you are not the intended recipient, be advised 
that you have received this email in error and that any use, dissemination, 
forwarding, printing, or copying of this email is strictly prohibited. If 
you have received this email in error, please contact the sender.
-----------------------------------------------------------------------


Mime
View raw message