Skip to main content

Web Service Programming for the Masses, Part I: Developing the Web Service API

Posted by stoicflame on January 9, 2008 at 11:33 AM PST

So you've got a web application that needs to expose a Web service API. Maybe you're going to be writing a href="http://en.wikipedia.org/wiki/Rich_Internet_application">Rich Internet Application (RIA) using href="http://en.wikipedia.org/wiki/Adobe_Flex">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. href="http://weblogs.java.net/blog/stoicflame/archive/2007/10/why_roi_vs_soi_1.html">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, href="http://www.json.org/">JSON, GWT-RPC, and even href="http://en.wikipedia.org/wiki/Action_Message_Format">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.

For those of you who would like to see the example code on your local filesystem, you can check it out of SVN at http://svn.codehaus.org/enunciate/trunk/enunciate/src/samples/addressbook/.

Step 1: Create Your Project

We will be exposing a Web service API for an address book application. We will be using Maven 2 and href="http://enunciate.codehaus.org">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.)

We'll label our application

Related Topics >>

Comments

Yes, I believe this is due to a bug in Enunciate 1.6. It happened randomly, and I think this is fixed with the latest 1.7 snapshot.

I'm getting a build failure. It seems that beneath the enunciate-test directory there is some source that references package net.java.ws.addressbook.amf.services, which does not exist.

I suspect there's a problem with your Maven environment. If you'd like to take this discussion to the enunciate-user list, we can likely figure it out there.

i did, i suppose, extacly what's written here but wen i run mvn jetty:run-war i get this build error war artifact 'spring.war.file' not found in the project