Weird, wonder if something else is broken. Can you try: post(versionDto /*
skip responseClass param to retrieve a Response */).readEntity(
VersionDto.class);

Side note: using org.apache.cxf.jaxrs.client.WebClient#getConfig you can
get the conduit - getHttpConduit() - from a jaxrs cxf client (Client
or WebTarget) so no need to change all your code and use CXF proprietary
API for other parts.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-04-15 16:02 GMT+02:00 sgjava <[email protected]>:

> I had JAX-RS POJO mapping working in TomEE using Jersey/Jackson (Glassfish
> impl) with javax.ws.rs.* packages, but I wanted to use connect and read
> timeouts. As suggested I tried the CXF impl built into TomEE, but I cannot
> get the response to map to the POJO. Here's the code in question:
>
>         final WebClient client = WebClient.create(url, Collections.
>                 singletonList(new JacksonJsonProvider()));
>         final HTTPConduit conduit =
> WebClient.getConfig(client).getHttpConduit();
>         conduit.getClient().setReceiveTimeout(7000);
>         conduit.getClient().setConnectionTimeout(7000);
>         final VersionDto versionDto = new VersionDto("xxx");
>         // This throws a 500 server exception
>         final VersionDto response = client.type(
>                 MediaType.APPLICATION_JSON_TYPE).accept(
>                         MediaType.APPLICATION_JSON_TYPE).post(versionDto,
>                         VersionDto.class);
>
>         // This will work but returns
> sun.net.www.protocol.http.HttpURLConnection$HttpInputStream
>         final Response response =
> client.type(MediaType.APPLICATION_JSON_TYPE).
>                 accept(MediaType.APPLICATION_JSON_TYPE).post(versionDto);
>
> I'm not able to find any complete examples.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JAX-RS-POJO-mapping-tp4674454.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Reply via email to