发送到仅SOAP 1.1端点时,SOAP 1.2消息无效

时间:2013-03-18 04:24:08

标签: java spring spring-batch

当从spring批处理应用程序调用spring-cxf-webservice时出现错误。这个错误只发生在它从批处理调用时。当从普通的肥皂用户界面调用它工作正常时。一旦它从批处理调用一些记录被处理。一些记录发生错误。检查批量和web服务的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)

批量配置

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

任何帮助或确定根本原因的方法都将受到赞赏

3 个答案:

答案 0 :(得分:2)

只需添加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>

答案 1 :(得分:1)

在您的服务界面上添加此注释,我尝试为我工作

@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)

生成类DeliveryService:

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

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

答案 2 :(得分:0)

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

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