很low的写法。刚开始学,服务器是axis类型。
Service service=new Service();
String endpoint="http://localhost:8888/webserviceTest/services/WebService1";//提供接口的地址
try{
Call call=(Call)service.createCall();
call.setTargetEndpointAddress( new URL(endpoint) );
call.setOperationName( new QName("urn:WebService1", "add") );
String v=(String)call.invoke(new Object[]{1,2});//调用方法并传递参数
System.out.println(v);
}catch(Exception ex) {
ex.printStackTrace();
}