[
https://issues.apache.org/jira/browse/CAMEL-9066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14680624#comment-14680624
]
Bob Blackard edited comment on CAMEL-9066 at 8/11/15 12:56 PM:
---------------------------------------------------------------
Patch to add functioning unit tests to camel-soap. This patch works from
2.12.x through 2.16.x.
was (Author: blackard):
Patch to add functioning unit tests to camel-soap. My first attempt at this I
made a mistake in capitalization which caused the tests to fail. This patch
should work from 2.12.x through 2.16.x.
> Include any headers unmarshalled by SoapJaxbDataFormat in content marshalled
> by the same.
> -----------------------------------------------------------------------------------------
>
> Key: CAMEL-9066
> URL: https://issues.apache.org/jira/browse/CAMEL-9066
> Project: Camel
> Issue Type: Improvement
> Components: camel-soap
> Affects Versions: 2.12.5, 2.16.0, 2.15.3, 2.14.4, Future, 2.16
> Environment: Any
> Reporter: Bob Blackard
> Assignee: Willem Jiang
> Labels: patch
> Fix For: 2.16.0, 2.15.3, 2.14.4, Future, 2.16
>
> Attachments: camel.patch, soapjaxb-header-marshal-example.zip,
> unit_tests.patch
>
>
> 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:
> from("direct:source").unmarshal(fromSoapDataFormat).process(doSomething).marshal(toSoapDataFormat).to("mock:end");
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)