java SOAP 1.2 消息在发送到仅限 SOAP 1.1 的端点时无效

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15469733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 19:43:24  来源:igfitidea点击:

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

javaspringspring-batch

提问by Sajith

I am getting a error, when calling a spring-cxf-webservice from spring batch application.This error is happening only when its calling from batch.When calling from the normal soap UI its working fine.And once its calling from batch some of the records getting processed.Error is happening for a few records.Checked the SOAP version of batch and webservice and its same.

我收到一个错误,当从 spring 批处理应用程序调用 spring-cxf-webservice 时。这个错误只在从批处理调用时发生。从普通的肥皂 UI 调用时,它工作正常。一旦从批处理调用一些记录正在处理。一些记录发生错误。检查批处理和网络服务的 SOAP 版本及其相同。

org.apache.cxf.binding.soap.SoapFault: A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint.
                at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:144)
                at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
                at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799)
                at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627)
                at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1494)
                at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1402)
                at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
                at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:649)
                at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
                at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:533)
                at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
                at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
                at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
                at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
                at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)

Batch Configuration

批量配置

<jaxws:client id="mainClient"
              serviceClass="com.batch.service.MainSoap"
              address="${url}" />

Any help or way to identify the root cause would be appreciated

任何帮助或确定根本原因的方法将不胜感激

回答by Peter

Just add the Soap-Binding.

只需添加肥皂绑定。

<jaxws:endpoint id="mainClient" serviceClass="com.batch.service.MainSoap"
  address="${url}">

  <jaxws:binding>
    <soap:soapBinding version="1.2" mtomEnabled="true" />
  </jaxws:binding>
</jaxws:endpoint>

回答by Surendra M

add this annotation on your service interface, I tried its working for me

在你的服务接口上添加这个注释,我试过它对我有用

@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)

The class DeliveryService is generated:

生成 DeliveryService 类:

 @WebService(targetNamespace = "http://...", name = "ServiceInterface")
 @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)

 public interface ServiceInterface {
 @WebResult(name = "response", targetNamespace = "http:///", partName = "response")

回答by Francois Gergaud

I just encounter the same problem using the CXF framework. It was due to a bad configuration of the endpoint: the wsdlLocation wasn't pointing at the wsdl-file... There is various way to define the wsdl location: it can be provide during the endpoint initialisation (the endpoint constructor take an optional wsdlLocation as parameter) or by giving the wsdl2java task an "wsdlLocation" argument (if you generate your classes from the wsdls).

我只是在使用 CXF 框架时遇到了同样的问题。这是由于端点的错误配置:wsdlLocation 没有指向 wsdl 文件...有多种方法可以定义 wsdl 位置:它可以在端点初始化期间提供(端点构造函数采用可选的wsdlLocation 作为参数)或通过给 wsdl2java 任务一个“wsdlLocation”参数(如果你从 wsdls 生成你的类)。

Pointing at a wrong wsdlLocation maybe the cause of this exception...

指向错误的 wsdlLocation 可能是此异常的原因...