title: Problem with passing SOAP headers using Apache CXF client
body: <p>I am trying to implement a simple client for a webservice, the only problem I am facing with the webservice is, it has a generic endpoint: <code>http://myserver3333.com:8080/ws/services</code> and the way you lookup for web services deployed is via SOAP header.</p>
  
  <p>So, for example, if you try to hit the service vis SOAP UI, </p>
  
  <ol>
  <li>the endpoint I specify is: <code>http://myserver3333.com:8080/ws/services</code></li>
  <li>In the SOAP headers I specific the following:<br>
  SERVICE-NAME = MyAwesomeService<br>
  OPERATION-NAME = makeMeMoreAwesome</li>
  </ol>
  
  <p>So, how can I do the same thing using apache cxf client?</p>
  
  <p>My current code:</p>
  
  <pre><code>    URL wsdlLocation = new URL("http://myserver3333.com:8080/ws/service");
  
      MyAwesomeService  service = new MyAwesomeService(wsdlLocation);
      MyAwesomeServicePort port = service.getMyAwesomeServiceSOAPPort();
  
      List&lt;Header&gt; headers = new ArrayList&lt;Header&gt;();
      Header operationNameHeader = new Header(new QName("OPERATION-NAME"), "makeMeMoreAwesome",
                                              new JAXBDataBinding(String.class));
      Header serviceNameHeader = new Header(new QName("SERVICE-NAME"), "MyAwesomeService",
                                              new JAXBDataBinding(String.class));
  
      headers.add(operationNameHeader);
      headers.add(serviceNameHeader);
  
      BindingProvider bindingProvider = (BindingProvider)port;
      bindingProvider.getRequestContext().put(Header.HEADER_LIST, headers);
  
      MakeMeMoreAwesomeRequest request = new MakeMeMoreAwesomeRequest();
      MakeMeMoreAwesomeResponse response = port.makeMeMoreAwesome(request);
  
      System.out.println(response.getAck());
  </code></pre>
  
  <p>But when I run this, I get this error:</p>
  
  <pre><code>Exception in thread "main" com.sun.xml.ws.wsdl.parser.InaccessibleWSDLException: 2 counts of InaccessibleWSDLException.
  
  java.io.IOException: Server returned HTTP response code: 500 for URL: http://myserver3333.com:8080/ws/services
  java.io.IOException: Server returned HTTP response code: 500 for URL: http://myserver3333.com:8080/ws/services?wsdl
  </code></pre>
  
  <p>Which is correct because there is no WSDL at that location, it need to follow the soap header to get the service.</p>
  
  <p>Update:</p>
  
  <p>After two points from @Daniel Kulp I am here:</p>
  
  <ol>
  <li>I added a new line: <code>bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://myserver3333.com:8080/ws/services");
  </code></li>
  </ol>
  
  <p>And now I get this error:</p>
  
  <pre><code>org.apache.cxf.binding.soap.SoapFault: "http://www.myserver.com/ws/services", the namespace on the "errorMessage" element, is not a valid SOAP version.
      at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.readVersion(ReadHeadersInterceptor.java:115)
      at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:141)
      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:771)
  </code></pre>
  
  <p>My assumption is, this error is same as <a href="http://mail-archives.apache.org/mod_mbox/cxf-users/200807.mbox/%3C18227463.post@talk.nabble.com%3E" rel="nofollow">this</a> one. But I am not using ?wsdl. So, any suggestions?</p>