Franz Forsthofer created CAMEL-8978:
---------------------------------------

             Summary: Setting of SOAP headers via the Camel Header 
"org.apache.cxf.headers.Header.list" not working for CXF data format "PAYLOAD" 
                 Key: CAMEL-8978
                 URL: https://issues.apache.org/jira/browse/CAMEL-8978
             Project: Camel
          Issue Type: Bug
          Components: camel-cxf
    Affects Versions: 2.15.2, 2.14.3
            Reporter: Franz Forsthofer
             Fix For: 2.15.3, 2.14.4, 2.16


In the camel-cxf documentation https://camel.apache.org/cxf.html is described 
in the chapter "How to deal with the message for a camel-cxf endpoint in 
PAYLOAD data format" that "You can use the Header.HEADER_LIST as the key to set 
or get the SOAP headers".

But this only works for getting SOAP headers.

If you want to set SOAP headers via the Camel header Header.HEADER_LIST, the 
headers are not taken into account in the CXF-to-endpoint.

I analysed the problem and found out that 
- the SOAP header list is forwarded to the CXF request context 
- that this header list is overwritten in CxfEndpoint.CamelCxfClientImpl by the 
CxfPayload.getHeaders() value.

My suggestion is that we merge the headers from the Camel header and the the 
CXF payload in CxfEndpoint.CamelCxfClientImpl. See the attached patch.

With the merging  we cover all different use cases:
- the headers can be set in the CxfPayload
- the headers can be set in the Camel header Header.list
- the headers can be set in the CXFPayload and the CamelHeader Header.list.

Also the case where the list instance in the CxfPayload is the same as in the 
Camel header (in this case no merge is necessary) is covered. This case happens 
if the from-endpoint is also a CXF endpoint and the CXF payload is forwarded to 
the to-CXF-endpoint.

I can commit the change. However, before I do it I want to have the agreement 
from the CXF experts.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to