首页 > Web开发 > 详细

Axis调用webservice接口例子

时间:2018-11-23 17:53:58      阅读:173      评论:0      收藏:0      [点我收藏+]

public String invokeByAxis(String requestParam,String method) {
String result = "";
Service service = new Service();
String endPoint = "http://******:8088/bsbiam/services/SoapTreasury4A?wsdl";
try {
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(endPoint);
call.addParameter("reqMsg", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.setOperationName(new QName(endPoint,method));
result = (String) call.invoke(new Object[]{requestParam});
System.out.println("返回值:" + result);
} catch (Exception e) {
System.out.print("WebService请求异常!! ");
e.printStackTrace();
}
return result;

}

 

备注:

requestParam: xml请求参数

method:请求的方法

reqMsg:方法中的参数

Axis调用webservice接口例子

原文:https://www.cnblogs.com/bky-234/p/10008836.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!