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;
}

转载于:https://www.cnblogs.com/bzsz-quan/p/9380674.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值