OK, that works now. Thanks again, Sergey! But: it only works when I cast to ResponseImpl as javax.ws.rs.core.Response doesn't provide a readEntity method.
Cheers, Daniel On 21.03.2013, at 22:50, Sergey Beryozkin wrote: > Hi > On 21/03/13 21:30, Daniel Bimschas wrote: >> Hi there! >> >> I'm currently trying to work with the CXF client API and the nice proxy >> feature it provides. Now, one of my API methods returns a >> javax.ws.rs.core.Response wrapping an entity. This entity is a JAXB >> annotated class which is serialized to JSON and shall be deserialized on >> client side. Now, when I execute the client I get the following error >> message: >> >> java.lang.ClassCastException: >> sun.net.www.protocol.http.HttpURLConnection$HttpInputStream cannot be cast >> to MyDtoClass >> >> According to [1] one can use the ResponseReader class such that the stream >> will be deserialized to the expected type. However, it seems that starting >> with CXF 2.7.0 (I'm using 2.7.3) this class is missing. Can you enlighten me >> here? >> > I'm really late on updating the documentation on the JAX-RS 2.0 features, the > 2.0 implementation work is still ongoing, > > The following will work: > > MyClass myclass = myResponse.readEntity(MyClass.class) > > Cheers, Sergey > >> Cheers, >> Daniel >> >> [1] >> http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-Limitations
