java使用axis2调用.net webservice接口

/**
* 测试 异常笔数,退费处理
* @return
*/
public static String refundHandle() {
LogUtil.info("===============调用退费接口开始=================");
try {

PropertiesUtil propUtil = new PropertiesUtil("RefundInf.properties");
Properties pros = propUtil.getProperties();
String webServiceURL = pros.getProperty("webServiceURL");
String actionStr = pros.getProperty("actionStr");
String actionName = pros.getProperty("actionName");

RPCServiceClient ser = new RPCServiceClient ();
Options options = ser.getOptions();

// 指定调用WebService的URL
// EndpointReference targetEPR = new EndpointReference("http://172.16.28.100:8089/PayAPICall.asmx");
EndpointReference targetEPR = new EndpointReference(webServiceURL);
options.setTo(targetEPR);
//options.setAction("命名空间/WS 方法名");
// options.setAction("http://www.hwsoft.com/RefundCallService");
options.setAction(actionStr);

// 指定sfexpressService方法的参数值
Object[] opAddEntryArgs = new Object[] { "test"};
// 指定sfexpressService方法返回值的数据类型的Class对象
Class[] classes = new Class[] { String.class };
// 指定要调用的sfexpressService方法及WSDL文件的命名空间
// QName opAddEntry = new QName("http://www.hwsoft.com/RefundCallService/","RefundCallService");
QName opAddEntry = new QName(actionStr+"/",actionName);
// 调用sfexpressService方法并输出该方法的返回值
Object[] str = ser.invokeBlocking(opAddEntry, opAddEntryArgs, classes);
String sss = str[0].toString();
LogUtil.info("===============调用退费接口成功================="+sss);
return sss;
} catch (AxisFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
LogUtil.info("===============调用退费接口出错================="+e.getMessage());
}
return null;
}

猜你喜欢

转载自www.cnblogs.com/bzsz-quan/p/9380674.html