org.springframework.web.client.HttpClientErrorException: 415 Unsupported Media Type

Asked on June 20, 2016
I am working on spring client using RestTemplate.put(). I am getting following error. Any clue?

Replied on June 23, 2016
Issue is with Unsupported MediaType. You need to fix it.
Find the sample example of RestTemplate.put().
Server code.@RequestMapping(value="/putdata/{id}/{name}", method = RequestMethod.PUT)
public void putData(@PathVariable(value = "id") String id,
@PathVariable(value = "name") String name, @RequestBody Address address) {
System.out.println("Id:"+ id+ " Name:"+ name);
System.out.println("District:"+ address.getDistrict());
System.out.println("Village:"+ address.getVillage());
}
Client code.
public class PutDemo {
public static void main(String args[]) {
RestTemplate restTemplate = new RestTemplate();
String url = "http://localhost:8080/spring-rest-1/data/putdata/{id}/{name}";
Map<String, String> map = new HashMap<String, String>();
map.put("id", "100");
map.put("name", "Ram");
Address address = new Address("Dhananjaypur", "Varanasi","UP");
restTemplate.put(url, address, map);
}
}
Find the URL
http://www.concretepage.com/spring/spring-mvc/spring-rest-client-resttemplate-consume-restful-web-service-example-xml-json#put