Announcement Announcement Module
No announcement yet.
no suitable HttpMessageConverter found for request type Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • no suitable HttpMessageConverter found for request type

    Hi All,

    When i invoke the postForObject () method i got exception in my android application.

    My code is:

    String url = "http://localhost:8080/rest/login";

    Sample sam = new Sample ();

    RestTemplate restTemplate = new RestTemplate(new CommonsClientHttpRequestFactory());

    ResponseType ms = new ResponseType ();

    ms = restTemplate.postForObject(url, mp, MySession.class); ---> when the control comes here i got below exception..

    Caused by: org.springframework.web.client.RestClientException : Could not write request: no suitable HttpMessageConverter found for request type [Sample ]

    Please help me to solve the above problem.

    Thanks in advance,

  • #2
    Hi Kumaresan, what kind of content type is the rest/login endpoint expecting? If you are trying to convert JSON, are you including the Jackson library in your classpath? I recommend looking at the Spring Android Showcase, as it has some examples of using the different message converters available in Rest Template.



    • #3
      public class login {

      public Response Login(Sample Sample) {

      ResponseSession ResponseSession= loginService.DoIt(Sample);
      return Response.ok(ResponseSession).build();

      the above code is my server side login method here Sample is a java pojo class ...

      now i want to call this REST service in android client using POST.

      pls help me in how to send the object Sample from Android client


      • #4
        Take a look at the thread: "Examples to make RestTemplate work with JSON?" in this forum. It was one of the first posts in this forum, it will be a page or two back.



        • #5
          yeah..i saw the thread..its initial post