title: Implement CXF client to read LIST from a REST server
body: <p>I am trying to implement a rest web service using Apache CXF and I want to return list of object as a response from server. So i have used generic entity to wrap my list on a server and everything is fine when I enter path from browser. It prints XML representation of object because I have used Jackson JAX-B but when i try to use JAX-RS client. I am getting an exception.</p>
  
  <blockquote>
    <p>Exception in thread "main" javax.ws.rs.client.ResponseProcessingException: Problem with reading the data, class XYZ, ContentType: <em>/</em>.
        at org.apache.cxf.jaxrs.impl.ResponseImpl.reportMessageHandlerProblem(ResponseImpl.java:433)
        at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:378)
        at org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:325)
        at org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:313)
        at XYZ.ABC()
        at XYZ.ABC()
    Caused by: javax.ws.rs.core.NoContentException: Message body is empty
        at org.apache.cxf.jaxrs.provider.AbstractJAXBProvider.reportEmptyContentLength(AbstractJAXBProvider.java:276)
        at org.apache.cxf.jaxrs.provider.JAXBElementProvider.readFrom(JAXBElementProvider.java:166)
        at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1325)
        at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:369)
        ... 4 more</p>
  </blockquote>
  
  <p>I have written a following client code to get data from server<code>
          final Client client = ClientBuilder.newClient();
          WebTarget webTarget = client.target(URI.create(PATH));
          Response response = webTarget.request(MediaType.APPLICATION_XML).get();
          List&lt;ABC&gt; obj = response.readEntity(new GenericType&lt;List&lt;ABC&gt;&gt;              (ABC.class){});</code></p>
  
  <p>But Apart from it I have tried many code to implement CXF client and get data from server but I am getting a same exception almost all the time. I have tried JAXRSCLIENTFactory also to implement client but the same exception.</p>