I am writing a spring mvc app(Spring newbie) which has to call a rest service. I have the rest service deployed in my VM(weblogic 10.3.6 in Linux) and the app I am writing is in my local laptop weblogic(10.3.6 in Windows 8.1).
When I try calling the rest service the request goes fine to the restservice app, but the response fails with the following message
org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class com.myclass.Acct] and content type [application/json;charset=UTF-8]
at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:110)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:572)
I am initializing the rest client in my controller & calling a method as below
Class1 ccc = new Class1();
Client client = new Client("REST URL","key","key1","USR",ccc);
client.getService("String"));
In the actual client, the call to rest service looks like this
Acct acct1 = restClient.getRestTemplate().getForObject("URL", Acct.class, "USR");
The error I get is here in the above line. I am not sure how to set the response type. When I change the Acct.class to String.class and Acct acct1 to Object acct1, then it works.
Do I need to set anything in my dispatcher-servlet.xml for the response type json? Let me know if any other configurations are needed to make this work. I did look at other posts related to this, but it did not help. Thanks.