title: Apache CXF: A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint
body: <p>first of all, I know that there are already some questions on SO about this topic but none of them solved my problem (or I am too stupid to understand them, that's a possibility as well).</p>
  
  <p>So, I have a WSDL. From the WSDL I've generated a Java client using Eclipse CXF plugin. Now I'm doing this:</p>
  
  <pre><code>JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
  factory.setServiceClass(MyServiceInterface.class);
  factory.setAddress("myEndpoint");
  List&lt;Interceptor&lt;? extends Message&gt;&gt; interceptors = new ArrayList&lt;Interceptor&lt;? extends Message&gt;&gt;();
  interceptors.add(new HeaderOutInterceptor());
  factory.setOutInterceptors(interceptors);
  
  MyServiceInterface service = (MyServiceInterface) factory.create();
  </code></pre>
  
  <p>The interceptor only adds an header to the requests I'm sending through the client:</p>
  
  <pre><code>message.put(Message.CONTENT_TYPE, "application/soap+xml");
  </code></pre>
  
  <p>I'm adding this manually since by default the content type is text/xml and I get a 415 error.</p>
  
  <p>The problem is that with this configuration I get this exception:</p>
  
  <pre><code>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:178)
  at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:69)
  at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
  </code></pre>
  
  <p>I've tried adding this annotation to the generated client interface:</p>
  
  <pre><code>@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
  </code></pre>
  
  <p>But nothing changed. Can anybody help me?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've added a cxf.xml file under the classpath. This is the content:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
  xmlns:soap="http://cxf.apache.org/bindings/soap"
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
         http://cxf.apache.org/bindings/soap 
         http://cxf.apache.org/schemas/configuration/soap.xsd
         http://cxf.apache.org/jaxws 
         http://cxf.apache.org/schemas/jaxws.xsd"&gt;
  
  &lt;jaxws:endpoint serviceName="ClabService" endpointName="ClabServicePort"&gt;
      &lt;jaxws:binding&gt;
          &lt;soap:soapBinding version="1.2" mtomEnabled="true" /&gt;
      &lt;/jaxws:binding&gt;
  &lt;/jaxws:endpoint&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>However, now I get this exception:</p>
  
  <pre><code>Exception in thread "main" java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxws.EndpointImpl---51955260': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: serviceClass must be set to a valid service interface or class
  </code></pre>
  
  <p>I've tried to add this during the factory configuration:</p>
  
  <pre><code>factory.setServiceClass(MyServiceInterface_Service.class);
  </code></pre>
  
  <p>but nothing changed.</p>