cxf调用webservice总结

具体代码

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());

你可能感兴趣的:(cxf调用webservice总结)