Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

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

like image 222
Sajith Avatar asked Mar 18 '13 04:03

Sajith


3 Answers

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).

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

like image 173
Francois Gergaud Avatar answered Nov 04 '22 22:11

Francois Gergaud


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

@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)

The class DeliveryService is generated:

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

 public interface ServiceInterface {
 @WebResult(name = "response", targetNamespace = "http:///", partName = "response")
like image 36
Surendra M Avatar answered Nov 04 '22 22:11

Surendra M


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>
like image 2
Peter Avatar answered Nov 04 '22 23:11

Peter