No, it's just a plain POJO with no annotations. I'm pretty sure I used Jackson to handle JSON-to-POJO and POJO-to_JSON without requiring annotations. That's not supported in CXF/JAX-RS?
Thanks Chris On Tue, Jul 14, 2015 at 2:59 PM, Sergey Beryozkin <[email protected]> wrote: > CXF JSONProvider only supports JAXB annotated beans, with XmlRootElement, is > Book.class in your code below a JAXB bean ? > Sergey > On 14/07/15 18:26, Chris Wolf wrote: >> >> Again, referring to the example code at: >> >> https://cwiki.apache.org/confluence/display/CXF20DOC/JAXRS+Testing >> >> This client code works: >> >> @Test >> public void testGetBookWithProxy() { >> MyJaxrsResource client = >> JAXRSClientFactory.create(ENDPOINT_ADDRESS, MyJaxrsResource.class); >> >> WebClient.getConfig(client).getRequestContext().put(LocalConduit.DIRECT_DISPATCH, >> Boolean.TRUE); >> WebClient.getConfig(client).setBus(bus); >> Response r = client.getBook("123"); >> String bookJSON = r.readEntity(String.class); >> log.info("JAXRS Client result: {}", bookJSON); >> } >> >> ...but this client code (which should try to unmarshall to object) doesn't >> work: >> >> @Test >> public void testGetBookWithWebClient() { >> List<Object> providers = new ArrayList<Object>(); >> // add custom providers if any >> providers.add(JSONProvider.class); >> >> WebClient client = WebClient.create(ENDPOINT_ADDRESS, providers); >> client.accept("application/json"); >> client.path("shelf/book"); >> Book book = client.query("id", 123L).get(Book.class); >> assertEquals(123L, book.getId()); >> } >> >> >> The error is: >> >> ResponseProcessingException: No message body reader has been found for >> class CXF_Test.cxf_test.Book, ContentType: application/json >> >> However, as can be seen, I configured the "JSONProvider", which I >> thought would unmarshal JSON to POJOs. >> >> Any ideas? >> > > > -- > Sergey Beryozkin > > Talend Community Coders > http://coders.talend.com/ > > Blog: http://sberyozkin.blogspot.com
