axis1和axis2客户端调用方法

1、axis1:
Service s=new Service();
Call c=(Call)s.createCall();

c.setTargetEndpointAddress("http://130.59.10.177:8090/services/WebService");
c.setOperationName(new QName("http://webservice.com","serviceName"));
c.addParameter("arg0",Constants.XSD_STRING, ParameterMode.IN);


c.setReturnType(Constants.XSD_STRING);   
Object o=c.invoke(new Object[]{"param"});
System.out.println(o);
2、axis2:
RPCServiceClient serviceClient = null;
try {
serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
// 指定调用WebService的URL
options.setAction("serviceName");
EndpointReference targetEPR = new EndpointReference(
"http://130.59.10.177:8090/services/WebService");
options.setTo(targetEPR);
serviceClient.setTargetEPR(targetEPR);
QName opAddEntry = new QName("http://webservice.com",
"serviceName");
String[] result = (String[]) serviceClient.invokeBlocking(opAddEntry,
new Object[] { "param" },
new Class[] { String[].class })[0];//返回结果为String数组

serviceClient.cleanupTransport();
System.out.println( result);
} catch (Exception e) {
e.printStackTrace();
}

你可能感兴趣的:(C++,c,webservice,C#)