CXF SOAP协议修改为1.2

    最近再用.net调用cxf写的webservice时,遇到了一系列问题,通过上网搜索资料,终于将问题解决,现记录如下:

    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>
参考:http://cxf.apache.org/docs/ws-addressing.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值