SoapHeaders are not passed in the SoapMessage to CXF service in apache camel
<p>I am not getting the SoapHeader tags in the Soap message in the cxf service invoked. My current code is as below:</p>

<p>I have defined a cxf:cxfEndpoint for the service:</p>

<pre><code>&lt;cxf:cxfEndpoint id="testService" address="${testserviceurl}"
    serviceClass="com.test.service.class" wsdlURL="test.wsdl"
    endpointName="ns:test" serviceName="ns:TestService"
    xmlns:ns="target.name.space.of.the.service"&gt;
    &lt;cxf:properties&gt;
        &lt;entry key="dataFormat" value="PAYLOAD" /&gt;
    &lt;/cxf:properties&gt;
&lt;/cxf:cxfEndpoint&gt;
</code></pre>

<p>And then before invoking my cxf endpoint, I have set the SoapHeader as:</p>

<pre><code>CxfPayload&lt;SoapHeader&gt; payload = exchange.getIn().getBody(
        CxfPayload.class);
List&lt;SoapHeader&gt; headers = payload.getHeaders();
SoapHeader header = new SoapHeader(new QName("HeaderName"), "Test");
headers.add(header);
</code></pre>

<p>I have also tried the approach:</p>

<pre><code>List&lt;SoapHeader&gt; soapHeaders = CastUtils.cast((List&lt;?&gt;) exchange
        .getIn().getHeader(Header.HEADER_LIST));
if (soapHeaders == null) {
    // we just create a new soap headers in case the header is null
    soapHeaders = new ArrayList&lt;SoapHeader&gt;();
}
SoapHeader header = new SoapHeader(new QName("HeaderName"),
        "Test");
header.setDirection(Direction.DIRECTION_OUT);
soapHeaders.add(header);
</code></pre>

<p>Can anyone please help on what is wrong with this?</p>