[
https://issues.apache.org/jira/browse/CAMEL-8313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Willem Jiang resolved CAMEL-8313.
---------------------------------
Resolution: Fixed
Applied the patch into camel master, camel-2.14.x and camel-2.13.x.
> AddNamespace should not override the element's namespace
> --------------------------------------------------------
>
> Key: CAMEL-8313
> URL: https://issues.apache.org/jira/browse/CAMEL-8313
> Project: Camel
> Issue Type: Bug
> Components: camel-cxf
> Affects Versions: 2.13.3, 2.14.1
> Reporter: Willem Jiang
> Assignee: Willem Jiang
> Fix For: 2.13.4, 2.14.2, 2.15.0
>
>
> I am running a web service in Cxf PAYLOAD mode and in one of the use cases I
> need to convert the body into Node (Element) and I am doing that by
> cxfpayload.getBody().get(0)
> This makes the namespaces from nsMap to be copied on to the element. While
> doing so, if the nsMap contains a namespace prefix that is also part of the
> element's attribute, it is being overwritten in the addNamespace(Element
> element, Map<String, String> nsMap) method.
> But when same prefix in soap Envelope and body contains different namespace
> values, that makes the body (XML) invalid.
> Here is a sample soap request that contains same namespace prefix ns1 in
> soap:Envelope and soap:Body but contains different namespace values.
> {code}
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:ns="http://www.example.com/location/consumerfundbalances/1/"
> xmlns:ns1="http://www.example.com/consumerfundbalances/retrievefundbalances/bi/1/">
> <soapenv:Body>
> <ns1:retrieveFundBalances
> xmlns="http://www.example.com/consumerfundbalances/retrievefundbalances/bi/1/"
> xmlns:ns1="http://www.example.com/location/consumerfundbalances/1/">
> <retrieveFundBalances>
> <fundBalancesRequestIdentifier/>
> </retrieveFundBalances>
> </ns1:retrieveFundBalances>
> </soapenv:Body>
> </soapenv:Envelope>
> {code}
> Now when I convert the payload into DOM Node, here is output XML namespace
> value for prefix ns1 is being replaced with the envelope.
> {code}
> <ns1:retrieveFundBalances
> xmlns:ns1="http://www.example.com/consumerfundbalances/retrievefundbalances/bi/1/"
>
> xmlns="http://www.example.com/consumerfundbalances/retrievefundbalances/bi/1/"
>
> xmlns:ns="http://www.example.com/location/consumerfundbalances/1/">
> <retrieveFundBalances>
> <fundBalancesRequestIdentifier/>
> </retrieveFundBalances>
> </ns1:retrieveFundBalances>
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)