users@jersey.java.net

Re: [Jersey] Client-side question

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 03 Nov 2009 09:14:16 +0100

On Nov 2, 2009, at 11:47 PM, Steve Cohen wrote:

> I need to write client side code to access a Vendor's Web Service
> which is supposed to be accessible by JAX-RS. I am given an XSD
> schema and a document telling me what URI parameters I need to set
> to extract the data from the service.
>
> Is there a way to generate Jersey-compatible data classes from the
> XSD or do I have to write them by hand?
>

You can use JAXB xjc [1] to compile the XSD into Java classes that can
be used with JAXB to marshall and unmarshall from and to XML
respectively.

And then you can use those generated Java classes with Jersey. See
JAXB sample:

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

Paul.

[1] https://jaxb.dev.java.net/nonav/2.1.12/docs/
      https://jaxb.dev.java.net/nonav/2.1.12/docs/xjc.html
      https://jaxb.dev.java.net/jaxb-maven2-plugin/