camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Venderov (JIRA)" <>
Subject [jira] [Created] (CAMEL-4143) CxfPayload to Node conversion is not working properly
Date Thu, 23 Jun 2011 06:57:47 GMT
CxfPayload to Node conversion is not working properly 

                 Key: CAMEL-4143
             Project: Camel
          Issue Type: Bug
          Components: camel-cxf
    Affects Versions: 2.8.0
            Reporter: Alexey Venderov
            Priority: Minor

We are using {{camel-cxf}} component and building it from the sources. Also we have slightly
modified {{CxfPayloadConverterTest.testCxfPayloadToNode}} test, added some additional checks.
Here are the changes that were made to the test:
---	(revision 6644)
+++	(revision 6686)
@@ -49,6 +49,7 @@
         DocumentBuilderFactory documentBuilderFactory =
+        documentBuilderFactory.setNamespaceAware(true);
         DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
         document = documentBuilder.parse(file);
@@ -118,5 +119,13 @@
         node = exchange.getIn().getBody(Node.class);
+        Element root = (Element) node;
+        assertEquals("root element name", "root", root.getNodeName());
+        assertEquals("root element namespace", "",
+                root.getNamespaceURI());
+        Element bar = (Element) root.getElementsByTagName("bar").item(0);
+        assertEquals("child element name", "bar", bar.getNodeName());
+        assertEquals("child element namespace", "",
+                bar.getNamespaceURI());
Since there is no explicit converter from {{CxfPayload}} to {{Node}} the fallback converter
from {{CxfPayloadConverter}} is used for this conversion. Fallback converter from {{CxfPayloadConverter}}
under the hood uses converters from {{XmlConverter}}. There are two suitable converters in
{{XmlConverter}} class which are randomly selected. Some times {{public Element toDOMElement(Node
node)}} converter is used and some times {{public Document toDOMDocument(final Node node)}}
converter is used. If {{public Document toDOMDocument(final Node node)}} converter is used
then test fails with {{ClassCastException}}. To avoid this, explicit converter from {{CxfPayload}}
to {{Node}} should be added. Patch that adds {{CxfPayload}} to {{Node}} converter is provided.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message