I am a complete newbie to REST services, but I need to access some information through REST from a website. The service has sample code to show how to log in to the system I used. The sample code uses Jettison as a JSON parser, but when I try to execute the following code fragment, I get an exception:
JSONObject post = baseResource.path("login") .queryParam("service", "ABC").queryParam("auth", authParam) .accept(MediaType.APPLICATION_JSON_TYPE).post(JSONObject.class);
baseResourse is a WebResource object. The code does not work with the following exception:
Exception in thread "main" com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java class org.codehaus.jettison.json.JSONObject, and Java type class org.codehaus.jettison.json.JSONObject, and MIME media type application/json; character=utf-8 was not found
The sample code does not suggest that I will need to add βmessage body readersβ to handle the response? Or do I need to add or do something obvious to analyze the answer? Thanks.
source share