users@jersey.java.net

Re: [Jersey] Unmarshalling list of Jaxb elements using jersey client

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 10 Mar 2009 17:36:40 +0100

On Mar 10, 2009, at 5:24 PM, Erdinc Yilmazel wrote:

> I have methods returning list of objects that are annotated with
> @XmlRootElement
>
> @XmlRootElement(name = "registryEntry")
> public class RegistryEntry {
> ...
> }
>
> @GET
> @Produces({"application/xml", "application/json"})
> public ArrayList<RegistryEntry> getEntries(....) {
> ...
> }
>
> This works fine on the web service side, however I could not find a
> way of getting list of RegistryEntry classes on the client side. I
> know I can write a wrapper class and return it rather than an
> ArrayList, and unmarshall it on the jersey client side, but I will
> have to write many of these then.
>
> Any ideas for calling this service using jersey client?
>

See the following sample:

   http://download.java.net/maven/2/com/sun/jersey/samples/jaxb/1.0.2/jaxb-1.0.2-project.zip

Specifically the unit tests that use the client API.

Paul.