Skip to main content

JAX-WS RESTful Web Service - AJAX client

Posted by jitu on July 21, 2006 at 4:59 PM PDT

You have already seen quite a few examples of JAX-WS clients accessing RESTful clients. Marc's blog. I wrote a sample RESTful webservice using latest mustang JDK(b91).

A inventory store is implemented as a RESTful web service and the inventory items are accessed and updated as URL resources. The client is the browser and uses javascript's XMLHttpRequest to issue HTTP GET, PUT, POST, DELETE requests to the web service. The client's index.html itself is served by jax-ws endpoint. The Web Service implementation is based on JAX-WS Provider endpoints. These endpoints are powered by mustang JDK.

The rest.zip contains sources and run.sh. Once you run run.sh, it shows a URL that can be used from browser.

I tested the example with some browsers like IE, Firefox. IE poses some problems like caching, and doesn't send a default Content-Type with XMLHttpRequest.send(). So I added some extra lines in the index.html to take care of them.

Related Topics >>