I am trying to expose rest webservice using spring mvc 4. With these annotations in controller
@RequestMapping(value = "/services/empservice", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String testArgument(@RequestBody Employee employee){
System.out.println("employee variable--->"+employee.getEmployeeID());
return String.valueOf(20);
}
@PostMapping(value = "/services/empservices", produces = MediaType.APPLICATION_JSON_VALUE,headers = "content-type=application/x-www-form-urlencoded")
public String testArguments(@RequestBody Employee emploee){
System.out.println("employee variable--->"+employee.getEmployeeID());
return employee.getEmployeeID();
}
The response from WAS 8.5.5 gives 415 Media unsupported Status with response header Accept →application/octet-stream, text/plain, application/xml, text/xml, application/x-www-form-urlencoded, application/*+xml, multipart/form-data, /
Accept →application/x-www-form-urlencoded
How to get pass this error and how to set response header for getting application/json with json response