users@jersey.java.net

Re: Client-side question

From: Steve Cohen <stevecoh1_at_comcast.net>
Date: Tue, 03 Nov 2009 18:05:27 -0600

> On Nov 3, 2009, Paul Sandoz wrote:
>> 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/
>>
>>
Is it possible to use XmlBeans for the Java classes? I am getting
errors, but don't know if these can be gotten around or if I have to use
JaxB. What, specifically is the get() method needing to find in the
class specified?