title: Spring REST XML service not accepting XML as "accept" header
body: <p>I have several REST services defined that are currently returning JSON formatted objects as service response bodies. I'm trying to make this service also accept XML as a new requirement though it does not accept this.</p>
  
  <p>I'm following the <a href="https://github.com/SpringSource/spring-mvc-showcase.git" rel="nofollow">spring-mvc-showcase sample project</a> and have setup my <code>pom.xml</code> dependencies almost identically, my service definitions likewise are very simple.</p>
  
  <pre><code>@Controller
  @RequestMapping(value = "api/sales/*")
  public class SalesController {
  
      @RequestMapping(value = "/countries", method = RequestMethod.GET)
      @ResponseBody
      public List&lt;NamedEntity&gt; getCountries() {
  </code></pre>
  
  <p><code>NamedEntity</code> has the appropriate <code>@XmlRootElement</code> annotation.</p>
  
  <p>Could somebody explain the most basic requirements that I would need to get XML as a <code>ResponseBody</code> that the <a href="https://github.com/SpringSource/spring-mvc-showcase.git" rel="nofollow">spring-mvc-showcase sample project</a> is using.</p>
  
  <p><strong>EDIT</strong>: Added spring MVC sample.</p>
  
  <p>The sample from the spring-mvc-showcase is as follows:</p>
  
  <pre><code>package org.springframework.samples.mvc.messageconverters;
  
  @Controller
  @RequestMapping("messageconverters/*")
  public class MessageConvertersController {
  
      @RequestMapping(value="/xml", method=RequestMethod.GET)
      public @ResponseBody JavaBean writeXml() {
          return new JavaBean("bar", "fruit");
  </code></pre>