Hi As it happens it does not currently work for WebClient - I did not even think about writing a test for WebClient given that it was really needed for a proxy case. With the WebClient you can do
Book book = wc.get(Book.class) // returns the last Response, no remote invocation is done Response r = wc.getResponse(); That said, I've got it fixed - thanks for spotting the problem... Sergey On Sun, Jan 23, 2011 at 1:45 AM, Dan King <[email protected]> wrote: > > An example of ResponseReader (from the upcoming > > > Talend samples) is below: > > Again, though, this will unfortunately need to wait until CXF 2.3.2 is > out. > > > > HTH, > > Glen > > Thank you very much for the book suggestion and the ResponseReader example. > While I do understand the example, I'm having some difficulties getting it > to > work, specifically, I'm continually getting the exception: > > > Cannot cast object > 'sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@181305e' > with > class 'sun.net.www.protocol.http.HttpURLConnection$HttpInputStream' to > class > 'com.webprofiler.ws.dto.ProfileDto' > > > I have the cxf-bundle-minimal-2.3.2.jar in my classpath and the relative > code is > below; do you see anything wrong? > > ResponseReader reader = new ResponseReader(); > reader.setEntityClass(ProfileDto.class); > WebClientcustWebClient = > WebClient.create(webClient.getBaseURI().toString(), > Collections.singletonList(reader)); > Response response = > > custWebClient.path("/search/profile").type("application/json").accept("application/json").post(criteria); > > if (response.getStatus() == 200 || response.getStatus() == 204) { > ProfileDto results = (ProfileDto) response.getEntity(); > ....code to generate view... > } > > Thanks > > -Dan > > > > >
