title: Parse Response Entity with CXF Rest client
body: <p>I'm working with CXF 2.3.2, I made this REST Service:</p>
  
  <p>Interface:</p>
  
  <pre><code>@WebMethod
  @GET
  @Path("/object/{id}")
  @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
  public Response object(@PathParam("id") Long id);
  </code></pre>
  
  <p>Impl:</p>
  
  <pre><code>@Override
  public Response object(Long id) {
  
      CompanyVO company = new CompanyVO();
      company.setAddress("address");
      company.setFantasyName("fantasy name");
      company.setFiscalId("fiscalid");
      company.setGroups("groups");
  
      return Response.ok().type(MediaType.APPLICATION_XML).entity(company).build();
  }
  </code></pre>
  
  <p>I need to consume that service using a CXF REST Client and obtain the object Entity inside de Response as a Java Object, not as a InputStream.</p>
  
  <p>I made a first implementation as follows, using a ResponseReader class to wrap my Java Class:</p>
  
  <pre><code>String operation = "/object/{id}";
  
      ResponseReader reader = new ResponseReader();
      reader.setEntityClass(CompanyVO.class); 
  
      WebClient client = WebClient.create(PATH,  Collections.singletonList(reader));
      client.path(operation, 12L);
      client.accept(MediaType.APPLICATION_XML);
      client.type(MediaType.APPLICATION_XML);
  
      //the response's entity object should be this Class.
      CompanyVO company = new CompanyVO();
  
      Response response = client.get();
  
      //i get the entity object as a InputStream, but i need a CompanyVO.
      //i made this once, but i can't see the difference.
      Object entity = response.getEntity();
  </code></pre>
  
  <p>Maybe i made the service wrong or the client has  a bad conf. i need your help, please!</p>
  
  <p>The service is was configurated using Spring 3.0.5:</p>
  
  <pre><code>&lt;jaxrs:server id="serviceAdvisorRestServer" address="/rest"&gt;
  
      &lt;jaxrs:serviceBeans&gt;
          &lt;ref bean="fileService"/&gt;
      &lt;/jaxrs:serviceBeans&gt;
  
       &lt;jaxrs:extensionMappings&gt;
          &lt;entry key="json" value="application/json"/&gt;
          &lt;entry key="xml" value="application/xml"/&gt;
          &lt;entry key="html" value="text/html"/&gt;
          &lt;entry key="pdf" value="application/pdf"&gt;&lt;/entry&gt;
      &lt;/jaxrs:extensionMappings&gt; 
  </code></pre>
  
  <p></p>
  
  <p>Thanks!</p>