title: Adding Soap Action Header using Java
body: <p>How do I add soap action header in java. I tested the service in SoapUI using <code>&lt;a:Action s:mustUnderstand="1"&gt;MyServiceName&lt;/a:Action&gt;</code> in Header and it works fine as per this post <a href="https://stackoverflow.com/questions/25506656/soap-action-mismatch-error-while-testing-a-wcf-service-with-soapui/25521203?noredirect=1#comment47429291_25521203">SOAP Action mismatch error while testing a WCF service with SoapUI</a> .  Without this header I get <code>The SOAP action specified on the message, '', does not match the HTTP SOAP Action,</code> error which is the same error I get from my Java client application.</p>
  
  <p>PS: I used Apache CXF to generate the stubs from the wsdl. I also tried using JAX-WS RI by using wsimport to generate the java client stubs. Same error using both the cases.  </p>
  
  <p>Any thoughts?  I couldn't find a right conclusive post that address this issue in Java on SO.</p>
  
  <p>Here is what I tried but I guess using classes from com.sun... package is not recommended and could cause portability issues across different jdks.<a href="https://stackoverflow.com/questions/2322953/jax-ws-adding-soap-headers">JAX-WS - Adding SOAP Headers</a></p>