Spring Rest Service not working for XML response
<p>I am trying to create spring restful webservice application.
I need to design service which will return both json as well as xml. Currently by default json is returned as a response but i want to return xml as well.</p>

<p><strong>If i hit :</strong> <a href="http://localhost:8087/RestServices/rest/profile/" rel="nofollow">http://localhost:8087/RestServices/rest/profile/</a><strong>233</strong> or 233 <strong>.json</strong></p>

<p><strong>>></strong> i get json response as expected</p>

<p><strong>but if hit :</strong> <a href="http://localhost:8087/RestServices/rest/profile/" rel="nofollow">http://localhost:8087/RestServices/rest/profile/</a><strong>233.xml</strong> </p>

<p><strong>>></strong> i get error saying <strong>HTTP Status - 406</strong> The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.</p>

<p><strong>Technology Details :</strong>
Spring 4.0
Hibernate 4.0
Spring MVC.
RestController. </p>

<p><strong>Dependency/Jars Details :</strong></p>

<p>antlr-2.7.7.jar</p>

<p>aopalliance-1.0.jar</p>

<p>com.mysql.jdbc_5.1.5.jar</p>

<p>commons-logging-1.2.jar</p>

<p>dom4j-1.6.1.jar</p>

<p>hibernate-commons-annotations-4.0.5.Final.jar</p>

<p>hibernate-core-4.3.6.Final.jar</p>

<p>hibernate-entitymanager-4.3.6.Final.jar</p>

<p>hibernate-jpa-2.1-api-1.0.0.Final.jar</p>

<p>hibernate-validator-4.2.0.Final.jar</p>

<p><strong>jackson-annotations-2.4.1.jar</strong></p>

<p><strong>jackson-core-2.4.4.jar</strong></p>

<p><strong>jackson-core-asl-1.9.0.jar</strong></p>

<p><strong>jackson-databind-2.4.4.jar</strong></p>

<p><strong>jackson-dataformat-xml-2.5.0.jar</strong></p>

<p><strong>jackson-jaxrs-1.9.2.jar</strong></p>

<p><strong>jackson-mapper-asl-1.9.0.jar</strong></p>

<p><strong>jackson-xc-1.9.2.jar</strong></p>

<p>jandex-1.1.0.Final.jar</p>

<p>javassist-3.18.1-GA.jar</p>

<p><strong>jaxb-api-2.2.jar</strong></p>

<p>jboss-logging-3.1.3.GA.jar</p>

<p>jboss-logging-annotations-1.2.0.Beta1.jar</p>

<p>jboss-transaction-api_1.2_spec-1.0.0.Final.jar</p>

<p>log4j-1.2.17.jar</p>

<p>logback-classic-0.9.jar</p>

<p>logback-core-0.9.6.jar</p>

<p>servlet-api.jar</p>

<p>slf4j-api-1.6.1.jar</p>

<p>slf4j-log4j13-1.0.1.jar</p>

<p>slf4j.jar</p>

<p>spring-aop-4.0.0.RELEASE.jar</p>

<p>spring-aspects-4.0.0.RELEASE.jar</p>

<p>spring-beans-4.0.0.RELEASE.jar</p>

<p>spring-build-src-4.0.0.RELEASE.jar</p>

<p>spring-context-4.0.0.RELEASE.jar</p>

<p>spring-context-support-4.0.0.RELEASE.jar</p>

<p>spring-core-4.0.0.RELEASE.jar</p>

<p>spring-data-commons-1.6.3.RELEASE.jar</p>

<p>spring-data-jpa-1.4.1.RELEASE.jar</p>

<p>spring-expression-4.0.0.RELEASE.jar</p>

<p>spring-framework-bom-4.0.0.RELEASE.jar</p>

<p>spring-instrument-4.0.0.RELEASE.jar</p>

<p>spring-instrument-tomcat-4.0.0.RELEASE.jar</p>

<p>spring-jdbc-4.0.0.RELEASE.jar</p>

<p>spring-jdbc.jar</p>

<p>spring-jms-4.0.0.RELEASE.jar</p>

<p>spring-messaging-4.0.0.RELEASE.jar</p>

<p>spring-orm-4.0.0.RELEASE.jar</p>

<p>spring-oxm-4.0.0.RELEASE.jar</p>

<p>spring-test-4.0.0.RELEASE.jar</p>

<p>spring-tx-4.0.0.RELEASE.jar</p>

<p>spring-web-4.0.0.RELEASE.jar</p>

<p>spring-webmvc-4.0.0.RELEASE.jar</p>

<p>spring-webmvc-portlet-4.0.0.RELEASE.jar</p>

<p>spring-websocket-4.0.0.RELEASE.jar</p>

<p><strong>woodstox-core-asl-4.2.0.jar</strong></p>

<p><strong>DateRestController.java</strong></p>

<pre><code>@RestController
@RequestMapping("/rest")
public class DataRestController
{
    @RequestMapping(value = "/profile/{number}", method = 
     RequestMethod.GET)  
     public 
     List&lt;CustomerProfile&gt;getCustomerProfile(@PathVariable("number")   
     String number) 
     {

        return profileList;
     }
}
</code></pre>

<p><strong>ProfileModel.java</strong></p>

<pre><code>@XmlRootElement(name="profile")
@Entity
@Table(name = "profile")
public class Profile extends CommonBean
{
    @Column(name = "email")
    private String email;

    @Column(name = "mobile")
    private String mobile;

    @Column(name = "DOB")
    private Date dateOfBirth;


    @XmlElement
    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
       this.email = email;
    }

    public String getMobile()
    {
       return mobile;
    }

    public void setMobile(String mobile)
    {
      this.mobile = mobile;
    }

    public Date getDateOfBirth()
    {
      return dateOfBirth;
    }

    public void setDateOfBirth(Date dateOfBirth)
    {
       this.dateOfBirth = dateOfBirth;
    }
}
</code></pre>

<p><strong>controller-servlet.xml</strong></p>

<pre><code>&lt;beans&gt;

&lt;context:component-scan base-package="com.test" /&gt;



&lt;mvc:annotation-driven /&gt;

&lt;bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
&lt;property name="prefix"&gt;
    &lt;value&gt;/pages/&lt;/value&gt;
&lt;/property&gt;
&lt;property name="suffix"&gt;
    &lt;value&gt;.jsp&lt;/value&gt;
&lt;/property&gt;`enter code here`
&lt;/bean&gt;
&lt;/beans&gt;
</code></pre>

<p>So far  tried multiple jackson jar as highlighted above, i tried passing accept application/xml, i tried produced="application/xml"
but  nothing worked. 
Kindly let me know what i missing in above configuration. is it jars or some annotations or xml configuration ???</p>