I\'m generating client java code from a wsdl using \'wsimport\'. The wsdl has soap:header in the operation definitions like this
-exsh (true/false)
Enables or disables processing of implicit SOAP headers (i.e. SOAP headers defined in the wsdl:binding but not wsdl:portType section.) Processing the SOAP headers requires the SOAP binding jars available on the classpath which was not the default in CXF 2.4.x and older. You may need to add a dependency to cxf-rt-binding-soap for this flag to work. Default is false.
I could not comment so I am writing this here as an "answer".
I ran into the same situation where there was only body in the envelope. However after adding the '-XadditionalHeaders' argument, wsimport still refused to generate service methods with header arguments. I searched on the Internet and found a manual patch in the following link:
https://metro.java.net/2.0/guide/SOAP_headers.html
I did not do it in the code. Instead I changed the method signature of the web service operation method by adding arguments for the request header and annotating them with @WebParam(header=true)
. I have not tested it with a real web service server, but at least the SOAP message now looks correct (no longer headless).