Hi,

Yes. I want to apply namespaces on some element inside soap body.
I have {"arg0":"srinivas"} as input and want to get  output like below

        <ns2:helloWorld xmlns:ns2="http://service.ws.test.xxxxx.com/";>
                <arg0>Srinivas</arg0>
        </ns2:helloWorld>

I did something like this

        XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat();
                xmlJsonFormat.setEncoding("UTF-8");
                xmlJsonFormat.setSkipNamespaces(false);
                xmlJsonFormat.setForceTopLevelObject(false);
                xmlJsonFormat.setRemoveNamespacePrefixes(false);
                xmlJsonFormat.setRootName("helloWorld");

                List<XmlJsonDataFormat.NamespacesPerElementMapping> namespaces 
= new
ArrayList<XmlJsonDataFormat.NamespacesPerElementMapping>();
                namespaces.add(new
XmlJsonDataFormat.NamespacesPerElementMapping("helloWorld",
"|ns2|http://service.ws.test.xxxxx.com/";)); 
                xmlJsonFormat.setNamespaceMappings(namespaces);

With this configuration I am getting below output

*<?xml version="1.0" encoding="UTF-8"?>*
*<helloWorld </b>xmlns:ns="http://service.ws.test.xxxxx.com/";>
      <arg0>Srinivas</arg0>
</helloWorld>

Here there are two issues

1. I want to avoid <?xml version="1.0" encoding="UTF-8"?> tag in my output.
2. Namespace prefix is not coming for helloWorld tags

Any help?

Thanks
 





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-XmlJson-Question-tp5770021p5770592.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to