So you've got a web application that needs to expose a Web service API. Maybe you're going to be writing a Rich Internet Application (RIA) using Flex or some AJAX Framework. Or maybe you'll be developing a desktop application that needs to interface with your online data. Or perhaps you've got a few business partners that want to integrate with your application.
Whatever the reason, you need a solution that not only fits your client-side requirements, but one that is also easy to develop, easy to debug, easy to maintain, and easy to enhance. Don't be too hasty with your choice of a Web service implementation technology.REST is not always the best answer. It might be, but not always. Take some time to research your needs, gather your requirements, and look at other remoting technologies that are available. Then decide what you need.
This is the first part of a tutorial will walk you through developing a Web service API that could meet the requirements of all of the above-mentioned use cases. For the sake of clarity and brevity, we'll keep the operations simple, but by the time we're done, we'll have a fully-functional Web service API that exposes a bouquet of endpoints: SOAP, REST/XML, JSON, GWT-RPC, and even AMF (for all you Flex developers). In Part II of this tutorial, we'll prove out the Web service API by building a rich AJAX application with an embedded Flash component that accesses it.
By the end of this two-part tutorial, we'll have established a good custom-fit Web service development process for maintaining your Web service API in your favorite development environment.
We will be exposing a Web service API for an address book application. We will be using Maven 2 and Enunciate 1.6 to build and package our application. (Note that we could also use Ant to build the application, but Maven will get us started more quickly.)