Axis调用webservice接口例子


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.setEncodingStyle("utf-8");
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));

requestParam = new String(requestParam.getBytes(),"UTF-8");
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:方法中的参数


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM