Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to access the JSON reponse from a java client

 
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.
 
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
    Bookmark Topic Watch Topic
  • New Topic