Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access the JSON reponse from a java client

 
Dwijen Bhattacharjee
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have very basic knowledge of webservice. Currently I am trying to convert the response of a Webservice as JSON . I follow the steps mentioned in the [url]http://www.marcusschiesser.de/?p=130 [/url] link. Now I am getting the response as a JSON object . But the problem I am facing is that how to access the response from a java client . I only know the use of OMElement to access the response from a webservice . so whenever I am trying to access the Webservice using OMElement from java clent its throwing an exception that "Unexpected chracter {.... expected <" . As per my understanding OMElement expects XML so it's expecting a response which started with < charecter , as my webservice's response is JSON .So it throws the exception. My question is how can i access the JSON response from java client ?? It will be better if you will post some code snippet.
 
Srikanth Kumar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make use of the thoughtworks XStram API to convert the webservice response to JSON string.

Download this from http://xstream.codehaus.org/download.html

And the sample code will be like this.



This link is also useful.

http://xstream.codehaus.org/json-tutorial.html
 
Dwijen Bhattacharjee
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Srikanth
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic