axis2调用webservice

	public static long TIMEOUTINMILLISECONDS=100000;
	/**
	 * 调用webservice
	 * @param url webserviceURL
	 * @param methodName 调用方法名
	 * @param namespace 命名空间
	 * @param params 参数
	 * @param returnTypes 返回参数类型
	 * @return
	 * @throws AxisFault
	 */
	public static <T> Object[] invokeMethod(String url,String methodName,String namespace,Object[] params,Class<T>[] returnTypes) throws AxisFault{
		RPCServiceClient client=new RPCServiceClient();
		Options options=client.getOptions();
		EndpointReference epr=new EndpointReference(url);
		options.setTo(epr);
		options.setTimeOutInMilliSeconds(TIMEOUTINMILLISECONDS);
		QName qName=new QName(namespace, methodName);
		Object[] results=client.invokeBlocking(qName, params, returnTypes);
		return results;
	}

 调用方法java

一、传递单个参数web

Object[] objs = invokeMethod("http://localhost:8080/axis2/services/MobileWs", "getArrayTest", "http://ws.apache.org/axis2", new Object[] {"zhangsan"}, new Class[]{String.class});

 二、传递数组apache

Object[] objs = invokeMethod("http://localhost:8080/axis2/services/MobileWs", "getArrayTest", "http://ws.apache.org/axis2", new Object[] {new String[]{"zhangsan","lisi"}}, new Class[]{String.class});