Hi all,
I'm wondering if it is in any way possible to use the Jersey Client API
as the 'entry point' for HTTP communication for JAX-WS *client
requests*, eg:
Client client = ClientBuilder.newClient()
// configure HttpClient
Service service = ...;
StockQuote quoteService = (StockQuote)service.getPort(portName);
javax.xml.ws.BindingProvider bp =
(javax.xml.ws.BindingProvider)quoteService;
// SOMEHOW PUT 'client' in the BindingProvider to tell the JAX-WS
// TubelineAssembler(?) to use a "JerseyTransportTube" initialized
// with the specified Client instance
Float quote = quoteService.getPrice(ticker);
And that "getPrice()" request would be done using the provider "client"
instance. Also, this would need to work with the JAX-WS reference
implementation as included in JSE 7 & 8.
I've done a bit of reading on this, and I guess that theoretically this
is possible. The best idea I have at the moment in fact doesn't use the
BindingProvider. Instead I think the best way to implement this is by
creating a "JerseyClientFeature extends WebFeature", which acts as a
wrapper to a Jersey Client instance, and you use the
"getXXXPort(WebFeature ...)" variant of the port factory method, and
then register JerseyClientTransportTubeFactory and
JerseyClientTransportTube implementations with the JAX-WS framework.
That factory class would return an instance of JerseyClientTransportTube
if we asked for a Port with that feature, or the default
HttpTransportPipe if we didn't specify that feature.
Tell me if I'm dreaming here...
Maarten