You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Eric Roberts <er...@tacc.utexas.edu> on 2002/06/05 16:56:44 UTC

ArrayOutOfBoundsException

I am getting an ArrayOutOfBoundsException when I try to run the following 
code:

(begin code here)

package samples.userguide.example7;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;

import javax.xml.rpc.ParameterMode;

public class HelloClient
{
        public static void main(String [] args) throws Exception {

                Options options = new Options(args);

                String endpoint = "http://localhost:" + options.getPort() 
			+ "/axis/HelloWorld.jws";

                args = options.getRemainingArgs();

                if (args == null || args.length != 1) {
                        System.err.println("Usage: HelloClient arg1");
                        return;
                }

                String method = "getHello";
                String s1 = new String(args[0]);

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

                call.setTargetEndpointAddress(new java.net.URL(endpoint));
                call.setOperationName(method);
                call.addParameter( "op1", XMLType.XSD_STRING, ParameterMode.IN);
                call.setReturnType(XMLType.XSD_STRING);

Fails here-->   String ret = (String) call.invoke(new Object [] {s1});
                System.out.println(ret);
        }
}

After setting up some debug try/catch blocks around everything that 
involves an array I found that the problem lies in the line denoted "Fails 
here-->".


HelloWorld.jws is in my jakarta/webapps/axis directory and looks like the 
following:

public class HelloWorld {
        public String getHello(String name) {
                return "Hello"+ name;
        }
}


Any ideas??


-- 
_____________________________________________________________________
Eric Roberts                                 ericrobe@tacc.utexas.edu
Grid Computing Group                             
Texas Advanced Computing Center                 
University of Texas at Austin    http://www.tacc.utexas.edu/~ericrobe
_____________________________________________________________________