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

Include any headers unmarshalled by SoapJaxbDataFormat in content marshalled by the same.



    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Future, 2.12.5, 2.15.3, 2.16.0, 2.14.4
    • Fix Version/s: 2.16.0
    • Component/s: camel-soap
    • Labels:
    • Environment:


    • Patch Info:
      Patch Available
    • Estimated Complexity:
    • Flags:


      The current implementation of the Soap11DataFormatAdapter and Soap12DataFormatAdapter will never generate SOAP Headers when a JAXB object is the inputObject.

      If the unmarshal is done with ignoreUnmarshalledHeaders set to false, then the SoapJaxbDataFormat.SOAP_UNMARSHALLED_HEADER_LIST message header is populated with a list of Objects or JAXBElement<?>s. However, during the doMarshal, this message header is never referenced. Therefore, the sequence:


      will never produce SOAP Headers in the outbound document.

      The doUnmarshal passes the inputObject and an empty List<JAXBElement<?>> into createContentFromObject. However, is the inputObject is an ordinary JAXB object (or JAXBElement<?>) then no header content will be created, and since the Exchange isn't sent to createContentFromObject, the SoapJaxbDataFormat.SOAP_UNMARSHALLED_HEADER_LIST cannot be referenced.

      It seems to me that, if ignoreUnmarshalledHeaders is false, and the SoapJaxbDataFormat.SOAP_UNMARSHALLED_HEADER_LIST is non-empty, and in the event the inbound Exchange does not contain an Exception, then the contents of the SoapJaxbDataFormat.SOAP_UNMARSHALLED_HEADER_LIST should be added to the headerContent before the call to createContentFromObject.

      I have checked the code for SoapJaxbDataFormat, Soap11DataFormatAdapter and Soap12DataFormatAdapter from camel-soap 2.12.0 through 2.15.2 and it looks like these three classes haven't changed.

      I crated a demo project and patch, originally against JBoss Fuse 6.1.0, but offer it here for the camel-soap 2.12.x branch. I have also applied and tested the patch against camel-soap in the master branch (2.16-SNAPSHOT). Indeed, it looks like this patch can be applied from any point 2.12 and forward.

      The demo can be run against 2.12.5 (or any released version - just change the camel.version property in the POM) to demonstrate what I think is the failure. It can also be run against a patched 2.12.6-SNAPSHOT or 2.16-SNAPSHOT (again, just play around with the camel.version property) to demonstrate what I think is correct behavior.


        1. unit_tests.patch
          20 kB
          Bob Blackard
        2. soapjaxb-header-marshal-example.zip
          20 kB
          Bob Blackard
        3. camel.patch
          5 kB
          Bob Blackard



            • Assignee:
              njiang Willem Jiang
              blackard Bob Blackard
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: