Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.1
-
None
-
Ubuntu 14.04, Oracle Java 7
-
Unknown
Description
The following code fails:
public List<GameSession> 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<GameSession> games = response.readEntity( new GenericType<List<GameSession>>(GameSession.class) {}); cookieStore.remember(response.getCookies()); return games; }
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):
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
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.