Exception converting a Json retrieved from Oracle Apex to a POJO with Spring & Jackson

we have a rest web service with Oracle 11g and Apex on the server side. On the client side we are developing for android, and using Spring 1.0.1 and Jackson 2.2.3 libraries to manage the requests of the rest webservices and convert the json data back into a pojo. It works very well when the webservice is a "query". The resultset-Json data is converted in an array of Pojos without problem. But when we try to do the same with a oracle procedure, it fails with an exception. The Json data returned by the procedure is the following: {"item":"{\r\n \"user\" : \"{john}\",\r\n \"profile\" : \"nothing\"\r\n}"} I tried an online Json validator, and the Json data appears to be valid. In the header you can also see that the type is "application/json". The pojo object is as follows: public class User { public String getUser() { return user; } public void setUser(String user) { this.user = user; } private String user; public String getProfile() { return profile; } public void setProfile(String profile) { this.profile = profile; } private String profile; } The code that calls the webservice and tries to convert json to pojo is the following (copied from the spring examples): RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); User users = restTemplate.getForObject(url, User.class); And at last, the exception when it tries to do "getForObject": org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [com.xxx.xxx] and content type [text/plain;charset=iso-8859-1] I tried to do the same with the Gson library instead the Jackson library, and the same exception is trown. Now I'm blocked since a couple of days... Any ideas? What I'm doing wrong? Thanks in advance,

以上就是Exception converting a Json retrieved from Oracle Apex to a POJO with Spring & Jackson的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JSON 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准