Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-8978

Setting of SOAP headers via the Camel Header "org.apache.cxf.headers.Header.list" not working for CXF data format "PAYLOAD"



    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.14.3, 2.15.2
    • Fix Version/s: 2.16.0
    • Component/s: camel-cxf
    • Labels:
    • Patch Info:
      Patch Available
    • Estimated Complexity:


      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.




            • Assignee:
              forsthofer Franz Forsthofer
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: