Do you use Jackson or default Jettison provider ? Cheers, Sergey
On Tue, Apr 26, 2011 at 5:02 PM, KARR, DAVID (ATTSI) <[email protected]> wrote: > I'm returning an instance of the following paraphrased class from my handler > method: > > @XmlType(name = "activeThings", propOrder = {"things"}) > @XmlRootElement(name = "activeThings") > public class GetActiveThingsResponse extends ResponseBase { > @XmlElementWrapper(name = "things") > @XmlElement(name = "thing") > private List<Thing> things; > > Where "ResponseBase" looks like this: > > @XmlType(name = "responseBase") > public class ResponseBase { > @XmlElementWrapper(name = "errors") > @XmlElement(name = "error") > private List<Error> errors; > private boolean lastBlock; > > When this is rendered as XML, it looks like this: > > <activeThings > xmlns="namespace"><lastBlock>false</lastBlock><things><thing><id>1</id></thing></things></activeThings> > > This is fine. > > When it's rendered as JSON, it looks like this: > > {"things":[{"id":1,"longDescription":null,"displayName":null,"description":null}],"errors":[],"lastBlock":false} > > This looks reasonable, but when WebClient tries to "get" the object of this > type, it fails with this: > > Apr 26, 2011 8:48:05 AM org.apache.cxf.jaxrs.provider.AbstractJAXBProvider > handleJAXBException > WARNING: javax.xml.bind.UnmarshalException > - with linked exception: > [javax.xml.bind.UnmarshalException: unexpected element (uri:"", > local:"things"). Expected elements are <{namespace}activeThings>] > > This is happening in my unit tests, not in my core code, but it's still > preventing me from testing some aspects of the JSON rendering. >
