Hi Jonathan!

Chris makes some good points, although I'm not sure I'd classify the docs as 
"excellent" yet. :)

To address the particular scenario you mention (returning an ArrayList), you really 
don't have to do anything complicated...

On the server, just deploy a service which returns an ArrayList, for instance:

MyService.java:
public class MyService {
    public ArrayList getArray() {
        ArrayList list = new ArrayList();
        list.add("Testing");
        return list;
    }
}

deploy.wsdd:
<service name="MyServiceName" provider="java:RPC">
  <parameter name="className" value="MyService"/>
  <parameter name="allowedMethods" value="getArray"/>
</service>

(imports / namespace declarations elided)

On the client, call the service as usual but make sure to use the setReturnClass 
method on the Call object:

    Call call = new Call("http://localhost:8080/axis/services/MyServiceName";);
    call.setReturnClass(ArrayList.class);
    // Now you can invoke the call
    ArrayList result = (ArrayList)call.invoke("getArray", null);

This method allows Axis to automatically convert the return type (which would be an 
Object[]) to an ArrayList for you.

--Glen

> -----Original Message-----
> From: Chris Haddad [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 8:28 AM
> To: [EMAIL PROTECTED]; 'Jonathan'
> Subject: RE: Using the Axis api
> 
> 
> Johnathan -  
> 
> The Axis documentation is an excellent start :)
> 
> Also, the samples and /java/test code provide good practical insights.
> 
> But, another way to learn the Axis API, is to run WSDL2Java and
> Java2WSDL.  WSDL2Java can be used to boot up a service 
> definition from a
> Java business object.  The Axis WSDL2Java utility will create 
> server and
> client side stub code.  You can then review the source and see how the
> API calls should be structured.
> 
> /Chris
> 
> -----Original Message-----
> From: Jonathan [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, April 24, 2002 11:22 PM
> To: [EMAIL PROTECTED]
> Subject: Using the Axis api
> 
> Hello.
> I have played with some of the examples, and I am realizing that there
> is much more to "building" a soap call.� That is, thers are 
> many options
> and�additional api calls if you want the SOAP engine to do what you
> want.� For example, I am very confused as to what additional 
> api calls I
> need to make in order to act as a client retrieving an ArrayList type
> structure. I have to configure the correct call as a client, 
> and create
> & serialize the correct xml structure as a server.
> �
> Can someone steer me in the correct direction?
> (please do not just refer me to the AXIS documentation)
> 
> 

Reply via email to