Thursday, August 26, 2010 transport using JAXWS 2.2 HTTP SPI

In the previous post I've written about Apache CXF and JBossWS-CXF implementation of JAXWS 2.2 HTTP SPI. From a container point of view, a bit of additional coding is required for making an existing http server compliant too.

Similarly to what Jitendra Kotamraju did for Grizzly, I've just created a small project for using the JDK6 httpserver with this HTTP SPI, basically allowing any JAXWS 2.2 stack implementation to be used on top of it (not just the JAXWS RI as mentioned here). The project only runtime dependency is the JAXWS 2.2 API, so it's completely vendor agnostic (the project testsuite uses Apache CXF just for the sake of testing with a JAXWS 2.2 impl).
So, the following is now possible using any JAXWS 2.2 compliant implementation:


HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
HttpContext context = HttpServerContextFactory.createHttpContext(server, "/ctx", "/echo");

Endpoint endpoint = Endpoint.create(new EndpointBean());
endpoint.publish(context); // Use httpserver context for publishing
//invoke endpoint

The binaries for the project are on JBoss' Maven repository.


Glen Mazza said...

Hi Alessio, the code snippet in your blog doesn't seem to have any dependencies on the small project you created (unless I'm missing something), so I'm not sure how the project you created plays a role in this. Can you explain further? Thanks!

Alessio Soldano said...

Hi Glen,
sorry, I simply copied the snippet from a test I have in the same package of the HttpServerContextFactory... hence no import for that. I've just modified the snippet to make the dependency more clear. Thanks for pointing this out :-)

Alessio Soldano said...

btw, the source code of the mentioned test is at

Alessio Soldano said...

For the records, the project has been released in its first final version:


Maven artifacts