XML : "Not Acceptable" error in Spring REST webservice on returning xml(produces="application/xml") response type

I am working on a webservice that should return json and xml (depending on user choice) to the user, I am using the simplest approach for this, that is to define two actions and change the (produces="") to whatever is required. I have defined the xml returning action as,
  @RequestMapping(value = "/getToken", produces="application/xml", method = RequestMethod.POST)  public Map<String,String> getToken(@RequestParam("username")String username, @RequestParam("password")String password)    
this function is giving a "Not Acceptable" error upon hitting it, when I am trying this with,
  produces="application/json"    
it works fine. Can anyone please help?

No comments:

Post a Comment