java向.net的webservice发送请求

示例代码:

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