camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vanshul.Chawla <Vanshul.Cha...@target.com>
Subject RE: Camel XmlJson Question
Date Wed, 29 Jul 2015 03:29:06 GMT
http://camel.apache.org/xmljson.html

This gives examples also. You just need to set dataFormat and use a process ref for xmljson.
It gives default element names. In case you need to change the element names, you need to
use expended properties.

import org.json.JSONException;
import org.json.JSONObject;
import org.json.XML;

public class JsontoXML {

  /**
   * @param args
   * @throws JSONException 
   */
  public static void main(String[] args) throws JSONException {
    String jsonStr = "";
    JSONObject jsonObj = new JSONObject(jsonStr);
    System.out.println("<Root>"+XML.toString(jsonObj)+"</Root>");
  }

}

This java code also converts json to xml.
String jsonStr="" needs to be changed to read from input exchange.

Thanks and Regards,

Vanshul Chawla


-----Original Message-----
From: srinit [mailto:sree.tallapalli@gmail.com] 
Sent: Tuesday, July 28, 2015 8:22 PM
To: users@camel.apache.org
Subject: Camel XmlJson Question

Hi Folks,

I am very new to Camel library and getting confused whether I am in right place for my requirement
or not?

Here is my requirement, I need conversion from xml to json and viceversa in java project.
Basically I need to convert a Xml SOAP message to Json and from json to SOAP Xml message with
namespaces and other informations from SOAP message.

I feel Camel XmlJson can help to do this. But neither I did find any simple example to understand
xmlJson module nor good documentation to understand functionality of Camel xmlJson.

Can some one point me any resources to understand the xmlJson of Camel?

Thanks



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

Mime
View raw message