Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 42A761027A for ; Tue, 2 Dec 2014 10:53:14 +0000 (UTC) Received: (qmail 85053 invoked by uid 500); 2 Dec 2014 10:53:13 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 84920 invoked by uid 500); 2 Dec 2014 10:53:13 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 84857 invoked by uid 99); 2 Dec 2014 10:53:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Dec 2014 10:53:13 +0000 Date: Tue, 2 Dec 2014 10:53:13 +0000 (UTC) From: "Sergey Beryozkin (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (CXF-5980) JAX-RS 2.0 client: response.readEntity(new GenericType<...>{}) fails with "unexpected element" UnmarshalException MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-5980?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sergey Beryozkin resolved CXF-5980. ----------------------------------- Resolution: Fixed Fix Version/s: NeedMoreInfo Assignee: Sergey Beryozkin Please provide a test case if you'd like this issue be revisited > JAX-RS 2.0 client: response.readEntity(new GenericType<...>{}) fails with "unexpected element" UnmarshalException > ----------------------------------------------------------------------------------------------------------------- > > Key: CXF-5980 > URL: https://issues.apache.org/jira/browse/CXF-5980 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 3.0.1 > Environment: Ubuntu 14.04, Oracle Java 7 > Reporter: Karl M. Davis > Assignee: Sergey Beryozkin > Fix For: NeedMoreInfo > > Attachments: cxf-generictype-jaxrs-client-log.txt > > > The following code fails: > {code:Java} > public List getGamesForPlayer() { > Client client = ClientBuilder.newClient(); > Builder requestBuilder = client.target(config.getServiceRoot()) > .path(IGameSessionResource.SERVICE_PATH) > .path(IGameSessionResource.SERVICE_PATH_GAMES_FOR_PLAYER) > .request(MediaType.TEXT_XML_TYPE); > cookieStore.applyCookies(requestBuilder); > Response response = requestBuilder.get(); > if (Status.Family.familyOf(response.getStatus()) != Status.Family.SUCCESSFUL) > throw new HttpClientException(response.getStatusInfo()); > List games = response.readEntity( > new GenericType>(GameSession.class) {}); > cookieStore.remember(response.getCookies()); > return games; > } > {code} > With the following root exception (I'll attach the full log out/stack tracce so you can see where in CXF this is coming from): > {code} > javax.xml.bind.UnmarshalException: unexpected element (uri:"http://justdavis.com/karl/rpstourney/api/schema/v1", local:"gameSessions"). Expected elements are <{http://justdavis.com/karl/rpstourney/api/schema/v1}account>,<{http://justdavis.com/karl/rpstourney/api/schema/v1}gameRound>,<{http://justdavis.com/karl/rpstourney/api/schema/v1}gameSession>,<{http://justdavis.com/karl/rpstourney/api/schema/v1}player> > ... 93 common frames omitted > {code} > This is the first time I've tried to pull a generic/collection object out of a Response using CXF's JAX-RS 2.0 client, so my guess is that this is just an unsupported edge case? For what it's worth, the server-side of the web service being queried is hosted by the same version of CSF and handles this just fine-- only the client seems to have issues. -- This message was sent by Atlassian JIRA (v6.3.4#6332)