AXIS调用方法:
String endpoint = "http://****?wsdl";
org.apache.axis.client.Service service = new
org.apache.axis.client.Service();
org.apache.axis.client.Call call = (org.apache.axis.client.Call)
service.createCall();
call.setTargetEndpointAddress(endpoint);
call.setOperationName(new
QName("***","GetPath"));//
call.addParameter("paramXml", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
String temp ="111";
String result = (String) call.invoke(new Object[] { temp });
System.out.println("result is " + result);
AXIS2调用方法:
RPCServiceClient serviceClient = new RPCServiceClient();
Options options =serviceClient.getOptions();
EndpointReference targetEPR = new EndpointReference(url);
options.setTo( targetEPR );
options.setTimeOutInMilliSeconds( 10000 );
String method = "GetPath";//webservice的方法名
String xml = "111";
Object[] param = new Object[] {xml};
QName opName = new QName( "***", method );
Class[] returnTypes = new Class[]{String.class};
Object[] results =serviceClient.invokeBlocking( opName, param, returnTypes );
System.out.println(results[0].toString());
CXF调用方法(依赖jdk1.6,与老版本spring冲突):
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
org.apache.cxf.endpoint.Clientclient = dcf.createClient(url);
Object[] param = null;
String method = "GetPath";// webservice的方法名
String xml = "111";
param = new Object[] { xml };
Object[] obj = client.invoke(method,param);
System.out.println(obj[0].toString());
xfire调用方法:
Client client = null;
client = new Client(new URL(wsUrl));
Object[] param = null;
String method = "GetPath";// webservice的方法名
String xml = "111";
param = new Object[] { xml };
Object[] obj = client.invoke(method, param);
System.out.println(obj[0].toString());