加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

cxf调用webservice总结

发布时间:2020-12-16 23:53:45 所属栏目:安全 来源:网络整理
导读:具体代码 public class UserWebserviceProxy { ? private JaxWsProxyFactoryBean factoryBean; public JaxWsProxyFactoryBean proxyFactoryBean(String url) throws Exception { factoryBean = new JaxWsProxyFactoryBean(); factoryBean.getInInterceptors(

具体代码

public class UserWebserviceProxy { ?



private JaxWsProxyFactoryBean factoryBean;


public JaxWsProxyFactoryBean proxyFactoryBean(String url) throws Exception {
factoryBean = new JaxWsProxyFactoryBean();
factoryBean.getInInterceptors().add(new LoggingInInterceptor());
factoryBean.getOutInterceptors().add(new LoggingOutInterceptor());
factoryBean.setAddress(url);
return factoryBean;
}
// 用户登陆
public IUserInfoResponse userInfoLogin(String arg0,String arg1,String arg2,String arg3)
throws Exception {
factoryBean.setServiceClass(IClientUserService.class);
IClientUserService approvalService = (IClientUserService) factoryBean
.create();
return approvalService.userInfoLogin(arg0,arg1,arg2,arg3);

}


在Action类进行调用:

// 远程调用 String root = (String) PropertiesUtil.getValByKey("webservice_url",CommonConstants.CONFIG_FILE_PATH); UserWebserviceProxy websrviceProxy = new UserWebserviceProxy(); websrviceProxy.proxyFactoryBean(root); user.setPlatformId(CommonConstants.WISDOM_PLATFORM); String ip = InetAddress.getLocalHost().getHostAddress(); userInfoResponse = websrviceProxy.userInfoLogin(user.getUserName(),user.getPassword(),ip,user.getPlatformId());

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读