• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to access the JSON reponse from a java client

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You Srikanth
 
reply
    Bookmark Topic Watch Topic
  • New Topic