Suggestion required: RESTFUl webservice transform xml to Json

Hi I am new to Java and not sure how to proceed (kindly ignore any typos or my language). Can somebody help me out (just the Idea/how to proceed, dont need any sample code). I am trying to create a Restful Json webservice (using Spring MVC). The webservice that I am trying to create is kind of a wrapper for an existing XML based restful webservice. The Idea is to have one common platform, since all other existing services are exposed as as JSON services. My job is to fetch the XML transform it into a Json, but the tricky part is The Json schema is a superset of the XML schema (I mean it contains more elements that get filled with some default values). Please let me know if you need more info.

Thanks in advance.

Answers


One way to do it would be to use Jaxb to transform the the incoming XML to Java Objects. Build your Jaxb objects in a way that it contains all the elements, the one with default values and the elements in the incoming XML.

Ones the XMl is converted into Jaxb you can use org.springframework.http.converter.json.MappingJacksonHttpMessageConverter message converter to convert your Jaxb object to Json string.


Need Your Help

IE10 breaks CSS3 3D animations working in Webkit & Firefox

css internet-explorer css3 css-animations internet-explorer-10

I have a simple horizontal CSS3 3D flip effect on two divs which runs fine in Chrome, Safari and Firefox. But IE10 screws it up and does some strange additional animations on all axis as it seems.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.