axis调用webservice的方法 :
1.RPC方式
package com.elfenlied.getWebService;
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
public class GetHelloClient {
??? /**
??? ?* @param args
??? ?* @throws AxisFault
??? ?*/
??? public static void main(String[] args) throws AxisFault {
??? ??? RPCServiceClient r = new RPCServiceClient();
??? ??? Options options = r.getOptions();
??? ??? EndpointReference targetEpr = new EndpointReference("http://127.0.0.1:8080/axis2/services/HelloClient");
??? ??? options.setTo(targetEpr);
??? ??? Object[] objs = new Object[]{"不解释"};
??? ??? Class[] classes = new Class[]{String.class};
??? ??? QName qname = new QName("http://ws.apache.org/axis2","greeding");
??????? //1.调用的方法名,2.参数值列表3,类型列表 ??? ??? System.out.println(r.invokeBlocking(qname,objs,classes)[0]); ??? } }