示例代码:
public SimplePremiumClientImpl(String address, String userName, String passWord)
{
this.address = address;
this.userName = userName;
this.passWord = passWord;
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(IService.class);
factory.setAddress(address);
//log设置
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.getInInterceptors().add(new LoggingInInterceptor());
insurancePremiumService = (IService)factory.create();
//调用.net webservice必须加入
((BindingProvider)insurancePremiumService).getRequestContext().put("SOAPAction","http://service.ins.org/carins/IService/SendInsuranceStatus");
}
主要是这个设置:
((BindingProvider)insurancePremiumService).getRequestContext().put("SOAPAction","http://service.ins.org/carins/IService/SendInsuranceStatus");
本文转自 winters1224 51CTO博客,原文链接:http://blog.51cto.com/winters1224/797765,如需转载请自行联系原作者