Returning a List<Map<String,Object>>> as XML using Jersey

shaqif

New Member
I have a REST service that returns a \[code\]List<Map<String,Object>>\[/code\] when a GET is performed on a particular resource. However it tries to return this list as \[code\]application/xml\[/code\] and fails with the following exception:\[quote\] javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class java.util.ArrayList, and Java type class java.util.ArrayList, and MIME media type application/xml was not found\[/quote\]The stack trace also gives me the following information:\[quote\] The registered message body writers compatible with the MIME media type are: application/xml ->
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$App
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App / ->\[/quote\]It seems I am missing a message body writer. Given that I am not sending any custom classes in the response I assume a message body writer class must already be out there.Is there a mising jar or config option I need to set to allow Jersey to return a List as xml?
 
Back
Top