WebService:设置服务器提供SOAP1.2的服务

问题解决,现记录如下:

    1)A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint.

        原因:soap协议不匹配,Server端用的是SOAP1.1,Client端用的是SOAP1.2        解决方法:在接口或类实现上添加

@BindingType(value = "http://www.w3.org/2003/05/soap/bindings/HTTP/")  或

@BindingType(value =SOAPBinding.SOAP12HTTP_BINDING),

    此时生成的wsdl文件可以看到:xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12

   注:需要引入geronimo-jaxws_2.2_spec-1.0.jar包,Maven下引入该包的pom文件为:

       <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jaxws_2.2_spec</artifactId>
            <version>1.0</version>
        </dependency>


2)解决完第1个问题后,接着出现了第二问题。

org.apache.cxf.binding.soap.SoapFault: MustUnderstand headers: [{http://www.w3.org/2005/08/addressing}Action,             {http://www.w3.org/2005/08/addressing}To] are not understood.

  原因:

  解决方法:开启ws-addressing

配置如下:

<jaxws:server id="ioWebservices" serviceClass="cn.webjt.steven.web.IOWebservices" address="/IOWS">
        <jaxws:features>
            <wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing"/>
          </jaxws:features>
        <jaxws:serviceBean>
            <ref bean="ioWebservicesBean" />
        </jaxws:serviceBean>
    </jaxws:server>