Hi all,
I am creating a REST Service and I want to be able to convert my input XML message to the Java object in my Spring Controller class.
The following is my configuration in Spring

Code:
@RequestMapping(
			value = "/user",
			method = RequestMethod.POST, headers = "content-type=application/xml"
		) 
		@ResponseBody
		public UserToken generateToken(@RequestBody UserToken userToken ) {
			System.out.println("I hit the service.");
			
			return	espiritService.getUserToken("hi2", "hi");
					
		}
This is my call that passes the XML
Code:
String strURL = "http://localhost:8080/RestEspiritProject/xyz/user"; 
		 // Get file to be posted
		 StringRequestEntity requestEntity = new StringRequestEntity(xmlString); 
		 PostMethod post = new PostMethod(strURL); 
		 post.setRequestEntity(requestEntity);  
		 post.setRequestHeader("Content-Type", "application/xml; charset=ISO-8859-1");
		 HttpClient httpClient = new HttpClient();
		 try {
			 int result = httpClient.executeMethod(post);

I am using the following mapper in my application.xml

Code:
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
	 <property name="order" value="1" />
	
	<property name="messageConverters">
	     <list >
	     <!--  <ref bean="stringHttpMessageConverter"/>  --> 
	       <ref bean="marshallingHttpMessageConverter"/> 
	    <!--    <ref bean="jacksonMessageConverter"/> -->
	     </list>
	   </property>
	</bean>
	<!-- <bean id="stringHttpMessageConverter"  class="org.springframework.http.converter.StringHttpMessageConverter"/> -->
	 <bean id="marshallingHttpMessageConverter" 	class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
		<property name="marshaller" ref="xstreamMarshaller" />
		<property name="unmarshaller" ref="xstreamMarshaller" />
	</bean> 
	<!--  <bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"/> -->
	 <bean class="org.springframework.oxm.xstream.XStreamMarshaller" id="xstreamMarshaller">
		<property name="autodetectAnnotations" value="true" />
	</bean>
But I am getting weired errors..
like this

Code:
Response status code: 400
Response body: 
<html><head><title>JBoss Web/3.0.0-CR2 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 400 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The request sent by the client was syntactically incorrect ().</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/3.0.0-CR2</h3></body></html>