在用cxf 做webservice客户端的时候碰到的:

javax.xml.ws.soap.SOAPFaultException: A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint.

在网上上找了一些资料但是还是不能解决我的问题,但是还是要感谢下, 不然太不厚道了

 写道
看来是soap协议不匹配 在接口或实现类上声明 @BindingType(value = "http://www.w3.org/2003/05/soap/bindings/HTTP/") 或者 @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) 注意要引入geronimo-jaxws_2.2_spec-1.0.jar包 生成的wsdl文件我们可以看到 xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/
在这些前提下 依然返回 同样的错误
于是我试着找源码,发现原来是这里 version 默认的就是 Soap11 instance 。 
  1. if (soapVersion == Soap12.getInstance()
  2. && version == Soap11.getInstance()) {
  3. throw new SoapFault(new Message("INVALID_11_VERSION", LOG, ns, xmlReader.getLocalName()),
  4. Soap11.getInstance().getVersionMismatch());
  5. }
回头看看CXF 在初始化的是否可以将 Soap12 设置进去 , ok 。
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="
  5. http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://cxf.apache.org/jaxws
  8. http://cxf.apache.org/schemas/jaxws.xsd">
  9. <bean id="jaxWsProxyFatory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
  10. <property name="bindingId" value="http://www.w3.org/2003/05/soap/bindings/HTTP/" />
  11. <property name="serviceClass" value="net.carefx.cds.v1.services.core.CdsCoreServices" />
  12. <property name="address" value="http://localhost:8181/cxf/coreServices" />
  13. </bean>
  14. <bean id="soapSerivces" class="net.carefx.cds.testtool.proxy.SoapServices">
  15. <property name="factory" ref="jaxWsProxyFatory" />
  16. </bean>
  17. </beans>
 
  1. <span style="font-weight: normal;">
  2. public class SoapServices
  3. {
  4. private static final Logger logger = new Logger (SoapServices.class.getName ());
  5. private JaxWsProxyFactoryBean m_factory;
  6. private CdsCoreServices cdsCoreServices;
  7. public JaxWsProxyFactoryBean getFactory ()
  8. {
  9. return m_factory;
  10. }
  11. public void setFactory (JaxWsProxyFactoryBean factory)
  12. {
  13. m_factory = factory;
  14. }
  15. public CdsCoreServices getCdsCoreServices ()
  16. {
  17. if (cdsCoreServices == null)
  18. {
  19. cdsCoreServices = (CdsCoreServices) m_factory.create ();
  20. }
  21. return cdsCoreServices;
  22. }
  23. }</span>
---------------------------------------------------------------------------------------------------------------------------------------------------------------

C# java JAX-WS 问题

webservices 是java写的,用 JDK自带的EndPoint发布,客户端是用C#调用,

在服务器端抛出异常,尽管执行是正常的。

Unsupported Content-Type: application/soap+xml;charset=UTF-8 Supported ones are: [text/xml]

请问这是什么问题? 怎么解决呢? Google 了半天也没找到答案

----------------------

经试验,是C#生成客户端的过程中抛出的,用wsimport 没问题。 是soap版本的问题?

这个问题是解决了, 确实版本问题, jdk6默认是soap1.1

增加 @BindingType("http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/")

高亮的地址真是难找,SOAPBinding 里面定义的是 http://www.w3.org/2003/05/soap/bindings/HTTP/, 但不能用,提示找不到

 ----------------------------------------------------------------------------------------------------------------------------------------------------
I think, I set everything to SOAP 1.2. I have attached a sevrver-client
communication, my WSDL and here is also my sun-jaxws.xml:
<?xml
version="1.0" encoding="UTF-8"?>
<endpoints version="2.0" xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime">
 
<endpoint
  name="FormDataService"
 
implementation="de.bolsys.netcon.gatewaydb.wsdl.DefaultFormDataService"
 
wsdl="WEB-INF/wsdl/netgateway.wsdl"
  binding="http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/"

url-pattern="/FormDataService"
  enable-mtom="true"/>

</endpoints>

My service annotations:
@WebService(name =
"formDataPortType", targetNamespace = "http://bolsys.de/netcon/gatewaydb/wsdl")

@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)

@BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING)

@XmlSeeAlso({
    ObjectFactory.class
})

My client
annotations:
@WebServiceClient(name = "FormDataService", targetNamespace =
"http://bolsys.de/netcon/gatewaydb/wsdl")

Did I
forget anything?
[Message sent by forum member 'radovana' (radovana)]

-------------------------------------------------------------------------------------------------------------------------------------
I have same problem with one of my web services. Here is the solution

It
is because your wsdl using soap11 binding, you can either change the binding to
soap12
like this " xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap12/"

or simply
remove binding="http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/"
from your deploy descriptor

SOAP1.1 and SOAP1.2的更多相关文章

  1. axis2设置soap1.1或soap1.2协议

    现在Axis.Axis2都是同时支持SOAP1.1和SOAP1.2的.即在服务器端发布一个WebService服务之后,客户端既可以通过SOAP1.1版本来访问服务器的服务,也可以通过SOAP1.2版 ...

  2. soap1.1与soap1.2

    1.soap1.2 如果加上jar包后,项目启动报错,有可能是jar包没起作用, 解决方法:把jar包移除,重新加入jar包 TCP/IP Monitor监测到的内容: soap1.2请求与soap1 ...

  3. 用java实现简单快速的webservice客户端/数据采集器(支持soap1.1和soap1.2标准,支持utf-8编码)

    前言: 用了cxf,axis等各种wbeservice实现库,简单试用了一下动态调用的方式,很不满意,完全无法满足业务的需要,所以自己实现了一个webservice采集客户端,方便动态调用外部webs ...

  4. SOAP1.1 VS SOAP1.2

    SOAP提升: 目前WebService的协议主要有SOAP1.1和1.2.两者的命名空间不同. 见下页对比 SOAP1.1版本与SOAP1.2版本在头信息上存在差异.SOAP1.1存在SOAPAct ...

  5. soap1.1与soap1.2区别

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

    1,访问通过cxf发布的服务 (1)与之前一样,同样可以通过在本地通过wsdl文件和命令行生成Java文件来访问服务. 但是我们既然使用了cxf发布,就要通过cxf的工具生成访问.可以通过cxf目录的 ...

  7. CXF支持 SOAP1.1 SOAP1.2协议

    SOAP协议分为两个版本 1.1 1.2 默认支持1.1   实现方式:   1.编写接口   import javax.jws.WebService; @WebService public inte ...

  8. webservice初识,SOAP1.1版本

    客户端与服务端模式,非web端发布 1.1      [Jax-ws第一个例子] 1.1.1     第一步:服务端开发 编写SEI(Service Endpoint Interface),SEI在w ...

  9. cxf ServerFactoryBean 生成基于soap1.2的WebServices

    //获得服务工厂bean ServerFactoryBean bean = new ServerFactoryBean(); HTTPTransportFactory httpTransportFac ...

随机推荐

  1. 开源应用框架BitAdminCore重构再思考

    索引 NET Core应用框架之BitAdminCore框架应用篇系列 框架演示:https://www.bitadmincore.com 框架源码:https://github.com/chenyi ...

  2. [UWP开发]在windows10中设置壁纸~UserProfilePersonalizationSettings

    在之前的wp8.1和wp8中,微软没有公开设置壁纸的API,只有一个设置锁屏的API,但在Windows10中,微软为我们提供了设置壁纸的API:TrySetWallpaperImageAsync,他 ...

  3. iOS 禁止多按钮同时响应

    只需要对相应的按钮添加一行代码 [aButton setExclusiveTouch:YES];

  4. 快速排序 JAVA实现

    快速排序 每次排序的时候设置一个基准点,将小于等于基准点的数全部放到基准点的左边,将大于等于基准点的数全部放到基准点的右边.快速排序是不稳定的,时间复杂度(平均):nlogn public class ...

  5. 546. Remove Boxes

    Given several boxes with different colors represented by different positive numbers. You may experie ...

  6. 关于OI中简单的常数优化

    有些东西借鉴了这里qwq 1.IO(istream/ostream) 输入输出优化 之后能,在赛场上常见的几种输入输出: 输入: $1.cin$ 呵呵,不说什么了,慢的要死.大概$1e8$个数要读1分 ...

  7. unittest测试框架和测试报告的输出实例(一)

    我们整个自动化才是报告的环节基本上分为三个部分: 1.测试用例的准备 2.测试用例的执行 3.测试报告的输出 1.测试用例的准备: 那我们就以搜孤网页做一个简单的用例: from selenium i ...

  8. psp0级报告

    计划 1.1需求描述: 现在市场上有很多的面向小学生的题卡,但是这习题卡不但价格昂贵,而且每次做题的内容基本都是固定.针对这些问题,开发出了这款网页在线答题系统,每次的题目都有所不同,可以跟快更好提高 ...

  9. Hyperledger Fabric

    https://wiki.hyperledger.org/display/fabric Hyperledger Fabric     转至元数据结尾   由 Tracy Kuhrt创建, 最终由 Da ...

  10. CentOS 7 安装过程中设置网络

    如果在安装过程中需要使用网络,需要启动网卡,默认是DHCP 点击configure进入设置 General 常规设置 Automatically connect to this network whe ...