give it the Webtarget
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-20 18:49 GMT+02:00 Steve Goldsmith <[email protected]>: > java.lang.IllegalArgumentException: Not a valid Client > > I guess it doesn't like javax.ws.rs.client.Client even though its > implementation is the CXF client? > > // Set up web client > final Client client = ClientBuilder.newClient(); > // Timeout not covered by client properties, so we go propritary > HTTPConduit httpConduit = > WebClient.getConfig(client).getHttpConduit(); > httpConduit.getClient().setReceiveTimeout(clientTimeout); > httpConduit.getClient().setConnectionTimeout(clientTimeout); > final VersionDto versionDto = new VersionDto("71.44.54.29"); > final VersionDto response = > client.target(url).request().post(Entity. > entity(versionDto, MediaType.APPLICATION_JSON), > VersionDto.class); > > > On Mon, Apr 20, 2015 at 12:25 PM, Romain Manni-Bucau < > [email protected]> > wrote: > > > call org.apache.cxf.jaxrs.client.WebClient#getConfig on your client, > > then org.apache.cxf.jaxrs.client.ClientConfiguration#getHttpConduit: > > > > WebClient.getConduit(jaxrsClient).getHttpConduit() > > > > Side note: when we'll upgrade cxf we'll get the feature you wanted: > > https://issues.apache.org/jira/browse/CXF-6353 > > > > > > 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-20 18:07 GMT+02:00 sgjava <[email protected]>: > > > > > OK, I just switched back to the generic javax.ws.rs.client.Client and > > > removed > > > the GlassFish stuff and it works. > > > > > > final Client client = ClientBuilder.newClient(); > > > final VersionDto versionDto = new VersionDto("xxx"); > > > final VersionDto response = > > > client.target(url).request().post(Entity. > > > entity(versionDto, MediaType.APPLICATION_JSON), > > > VersionDto.class); > > > > > > Now back to the timeout. In a previous post you said I could get > > > HttpConduit > > > from generic javax.ws.rs.client.Client? I noticed > > client.getConfiguration() > > > returns org.apache.cxf.jaxrs.impl.ConfigurationImpl. Will I be able to > do > > > use properties from this or do I need to do > > > conduit.getClient().setReceiveTimeout(7000)? > > > > > > > > > > > > -- > > > View this message in context: > > > > > > http://tomee-openejb.979440.n4.nabble.com/JAX-RS-POJO-mapping-tp4674454p4674523.html > > > Sent from the TomEE Users mailing list archive at Nabble.com. > > > > > > > > > -- > Steven P. Goldsmith >
