title: Need help on RestTemplate Post Request with Body Parameters?
body: <p>I have a rest api url and submitted the same as POST request with body (user name, password, other parameters) via Rest Client (restclient-ui-2.4-jar-with-dependencies) and it got worked fine without any issues.</p>
  
  <p>Ex:</p>
  
  <p>URL: <a href="https://test.com/cgi-bin/testing/api">https://test.com/cgi-bin/testing/api</a>
  Body: username=testuser&amp;password=pass123&amp;id=13002&amp;name=raju</p>
  
  <p>The same is not working fine when i used Spring RestTemplate postForObject(url, varmap, Employee.class) method.</p>
  
  <p>Can someone help me with a simple example where the request is a URL, with body parameters and the response is XML which is mapped with a class?</p>
  
  <p>Sample Code:</p>
  
  <pre><code>  MultiValueMap&lt;String, String&gt; map = new LinkedMultiValueMap&lt;String, String&gt;();
    map.add("username", "test");
    map.add("password", "test123");
    map.add("id", "1234");
    MarshallingHttpMessageConverter mc = new MarshallingHttpMessageConverter();
    mc.setMarshaller(new Jaxb2Marshaller());
    mc.setUnmarshaller(new Jaxb2Marshaller());
    list.add(marshallingHttpMessageConverter);
    emediateRestTemplate.setMessageConverters(list);
    Employee employee = (Employee) restTemplate.postForObject(url, map, Employee.class);
  </code></pre>
  
  <p>Thanks in advance,
  Kathir</p>