• Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom transport for JAX-WS client requests: jetty HttpClient

 
Maarten Boekhold
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(cross-posted on the jetty-user mailing list)

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:



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.

I've found a few examples of this TransportPipe stuff, but I can't figure out how I can initialize the 'pipeline' for a specific Service instance with an already initialized instance of the Jetty HttpClient.

Maarten
 
Maarten Boekhold
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Maarten Boekhold
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!