StackTraceCode:AuthenticateUser user = new AuthenticateUser(Credentials, Header); String Stringifiedjson = new Gson().toJson(user); Log.d("SpringAndroid", Stringifiedjson); HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setContentType(new MediaType("application", "json")); HttpEntity < AuthenticateUser > requestEntity = new HttpEntity < AuthenticateUser > (user, requestHeaders); RestTemplate restTemplate = new RestTemplate(true); restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter()); restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); final String url = getResources().getString(R.string.ProductionURL) + getResources().getString(R.string.AuthenticateUser); Log.d(this.getClass().getName(), url); try { ResponseEntity < String > responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class); result = responseEntity.getBody(); Log.d("Result", result); } catch (HttpClientErrorException e) { Log.d(Constants.HTTP_CLIENT_ERROR, e.getLocalizedMessage()); } catch (Exception e) { Log.d("It comes to here", e.getLocalizedMessage(), e); }
Code:10-23 20:37:59.245: D/It comes to here(3330): Could not write request: no suitable HttpMessageConverter found for request type [com.sample.transaction.AuthenticateUser] and content type [application/json] 10-23 20:37:59.245: D/It comes to here(3330): org.springframework.web.client.RestClientException: Could not write request: no suitable HttpMessageConverter found for request type [com.sample.transaction.AuthenticateUser] and content type [application/json] 10-23 20:37:59.245: D/It comes to here(3330): at org.springframework.web.client.RestTemplate$HttpEntityRequestCallback.doWithRequest(RestTemplate.java:632) 10-23 20:37:59.245: D/It comes to here(3330): at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:473) 10-23 20:37:59.245: D/It comes to here(3330): at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:438) 10-23 20:37:59.245: D/It comes to here(3330): at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:414) 10-23 20:37:59.245: D/It comes to here(3330): at com.sample.home.Trial$TrialAsyncTask.doInBackground(Trial.java:168) 10-23 20:37:59.245: D/It comes to here(3330): at com.sample.home.Trial$TrialAsyncTask.doInBackground(Trial.java:108) 10-23 20:37:59.245: D/It comes to here(3330): at android.os.AsyncTask$2.call(AsyncTask.java:287) 10-23 20:37:59.245: D/It comes to here(3330): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 10-23 20:37:59.245: D/It comes to here(3330): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 10-23 20:37:59.245: D/It comes to here(3330): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 10-23 20:37:59.245: D/It comes to here(3330): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 10-23 20:37:59.245: D/It comes to here(3330): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 10-23 20:37:59.245: D/It comes to here(3330): at java.lang.Thread.run(Thread.java:856)
1. What is that i am missing here, i am getting this error. I did a lot of google on this from morning and could not reach to a solution.
2. How can is end Stringified JSONObject to my Service without using MappingJacksonHttpMessageConverter.


Reply With Quote