users@jersey.java.net

Re: [Jersey] Problem(buig ?) with jersey 1.0.3.1

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 19 Oct 2009 22:03:46 +0200

Hi,

Are you using a ContextResolver to supply the JAXBContext for the JAXB
types?

If not i think you may need as by default Jersey will create a
JAXBContext directory from the type and that may not have enough
information to disambiguate XML documents defined for your schema.

If you are using a ContextResolver to supply the JAXBContext then i am
not sure. Creating a simple test case, preferably a maven project,
would be most helpful so i can investigate.

Paul.

On Oct 19, 2009, at 4:01 PM, vaidya nathan wrote:

> Hello,
>
> I have the following schema definition. The Event top level has an
> EventReq_type which has Errors element and within that an sequence
> of Error elements and then then directly under the Event top level
> it has Errors element which has a different element called
> serviceError.
>
> Event -> EventReq_type->Errors->Error
> and
> Event->Errors->serviceError
>
>
> <xs:complexType name="EventReq_type">
> <xs:sequence>
> <xs:element name="Event"
> type="ns1:Event_type"/>
> <xs:element name="Errors"
> type="tns:Error_type" minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
>
>
> <xs:complexType name="Event_type">
> <xs:complexContent>
> <xs:extension base="Event_Sum_type">
> <xs:sequence>
> <xs:element name="Errors"
> minOccurs="0">
> <xs:complexType>
> <xs:sequence>
>
> <xs:element name="Error" type="DifferentErrorType" minOccurs="0"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
>
>
>
> After generating through xjc , i can use the jaxb to marshall/
> unmarshall the elements but it is not able to pass through jersey(i
> used jersey 1.0.3 and jersey 1.0.3.1 and both gave the problems). I
> think that the jersey libraries are confused by the same name having
> different sub elements in different structure even though they are
> under different trees. If i change the name to be something else
> (for eg.instead of Event->Errors if i call it as Event-
> >ServiceErrors it goes through).The error that i get is that it is
> syntactically incorrect(HTTP code of 400).
>
> Thx