users@jersey.java.net

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

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 20 Oct 2009 09:00:06 +0200

On Oct 20, 2009, at 1:07 AM, vaidya nathan wrote:

> Paul,
>
> Thanx for the reply. I am not using any custom ContextResolver ,
> using the default jersey provided one. I will work on providing you
> with a sample project.
>

Since you are not using a custom ContextResolver i am not sure there
is any need to supply a sample project unless you would like help
defining what the ContextResolver should be.

If you know how to create a ContextResolver it might be quicker for
you to do that first.

You can find an example here:

https://jersey.dev.java.net/nonav/documentation/1.1.2-ea/user-
guide.html#json.jaxb.context.resolver.example

although this is focused on JSON configuration, using a
JSONJAXBContext, the same pattern applies for XML using JXXBContext

Paul.

>
> Thx
>
>
> On Mon, Oct 19, 2009 at 3:03 PM, Paul Sandoz <Paul.Sandoz_at_sun.com>
> wrote:
> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>