Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty HTTP Client as transport for JAX-WS requests

Hi all,

I've implemented something related to this, although not directly using the Jetty HttpClient. Due to internal reasons, I settled on the Jersey Client API. On a side note, you can tell the Jersey Client API to use the Jetty HttpClient underneath, so might still be useful here.

I've published some code at https://github.com/boekhold/jaxws-jersey-client-api. I'd be very interested to hear your feedback on this!

One note, the maarten.jaxws.jersey.client.JerseyClientTransportTube.checkStatusCode() method was copied pretty much verbatim from the JAX-WS RI at https://java.net/projects/jax-ws/sources/sources/content/tags/JAXWS_2_2_5_07282011/jaxws-ri/rt/src/com/sun/xml/ws/transport/http/client/HttpTransportPipe.java?rev=14203. I have no idea what implications that has on any licensing. If anybody can comment on that I'd be very grateful.

Maarten

On 2015-02-22 21:30, Gregor Jarisch wrote:
Hi Maarten,

yes, you are correct. I didn't read carefully enough, sorry for that. Nevertheless it also would be interesting for JAX-RS.

Gregor


Maarten Boekhold <boekhold@xxxxxxx> , 20.02.2015 17:23:

Hi gregor,

Unless I am missing something from your email, I think you misread  'JAX-WS'  as 'JAX-RS'...

Maarten

On 20 February 2015 17:00:50 Gregor Jarisch <gregor@xxxxxxxxxxx> wrote:

Hi Maarten,

you may wanna take a look at the client library implementation of Resteasy 3.x. Although they don't use jetty http client in their implementation (unfortunately), that might be a good starting point to look at how it is implemented in general (even if you not using resteasy as JAX-RS implementation). http://docs.jboss.org/resteasy/docs/3.0.9.Final/userguide/html_single/#RESTEasy_Client_Framework

Having said this; since http2 is close by and jetty close to releasing something useful here - how about trying to implement it with http2 already? Just a thought.

Gregor

Maarten Boekhold <boekhold@xxxxxxx> , 17.02.2015 12:26:
Hi,

Done some more research. I think something like the following should be possible:

  • Create a JettyHttpClientFeature extends WebServiceFeature that acts as the container for the HttpClient instance to use
  • Pass that feature as part of the service.getXXXPort(feature) "proxy factory" method
  • Create (and register) a JettyHttpClientTransportTubeFactory/JettyHttpClientTransportTube implementations
  • The factory has access to the ClientTubeAssemblerContext, which has access to WSBinding which has access to the WebServiceFeatures that were provided to the getXXXPort() method.
    • If our JettyHttpClientFeature is enabled, then return an instance of JettyHttpClientTransportTube (initialized with the HttpClient connection)
    • Otherwise return the default HttpTransportPipe (which implements Tube)

Any comments on this?

Maarten

On 2015-02-17 12:58, Maarten Boekhold wrote:
Hi all,

I am wondering if it is in any way possible to use the Jetty HTTP Client to handle the underlying HTTP communication for JAX-WS *client requests*, eg:

HttpClient client = new HttpClient();
// configure HttpClient

Service service = ...;
StockQuote quoteService = (StockQuote)service.getPort(portName);
javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider)quoteService;
Map<String,Object> context = bp.getRequestContext();
context.setProperty("HTTP.CLIENT", client);
Float quote = quoteService.getPrice(ticker);

And that request would be done using the "client" instance of HttpClient. Also, this would need to work with the JAX-WS reference implementation as included in JSE 7 & 8.

If something like this is not currently possible, does anybody have any idea where to start looking for what needs to be coded? I've been looking at the JAX-WS specifications, specifically chapters 5 & 6 (Service APIs and Core APIs), but I'm getting a bit lost. Googling also has turned up something related to "TransportPipeFactory", which I guess is specific to the reference implementation, because it's not mentioned in the JAX-WS standard specifications.

Maarten


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top