官方网页:http://ws.apache.org/axis/
Axis2服务端参照:使用Axis2开发Web服务 --- 环境部署
所需Jar包:
axis.jar
commons-logging-1.0.4.jar
commons-discovery-0.2.jar
jaxrpc.jar
saaj.jar
wsdl4j-1.5.1.jar
log4j-1.2.8.jar
代码如下:
packagesamples.clients;
importjavax.xml.namespace.QName;
importjavax.xml.rpc.ParameterMode;
importorg.apache.axis.client.Call;
importorg.apache.axis.client.Service;
importorg.apache.axis.encoding.XMLType;
publicclassStockQuoteServiceClient{
publicstaticvoidmain(String[]args){
try{
StringendpointURL="http://localhost:8080/Axis2Web/services/StockQuoteService?wsdl";
Serviceservice=newService();
Callcall=(Call)service.createCall();
call.setTargetEndpointAddress(newjava.net.URL(endpointURL));
call.setOperationName(newQName("http://quickstart.samples/xsd","getPrice"));
call.addParameter("symbol",XMLType.SOAP_STRING,ParameterMode.IN);
call.setReturnType(XMLType.SOAP_STRING);
Stringret=(String)call.invoke(newObject[]{"ShenBin"});
System.out.println(ret);
}catch(Exceptione){
}
}
}