Chapter 3. Writing Your First Grid Service in 5 Simple Steps

MathService

In this chapter we are going to write and deploy a simple Grid Service. Our first Grid Service is an extremely simple Math Grid Service, which we'll refer to as MathService. It will allow users to perform the following operations:

High-tech stuff, huh? Don't worry if this seems a bit lackluster. Since this is going to be our first Grid Service, it's better to start with a small didactic service which we'll gradually improve by adding service data, notifications, etc. You should always bear in mind that MathService is, after all, just a means to get acquainted with GT3. Typical grid services are generally much more complex and do more than expose trivial operations (such as addition and subtraction). Although the tutorial is currently based only on MathService, future versions of the tutorial will include examples of grid services which you could find in 'real' applications.

The Five Steps

Writing and deploying a Grid Service is easier than you might think. You just have to follow five simple steps.

  1. Define the service's interface. This is done with GWSDL

  2. Implement the service. This is done with Java

  3. Define the deployment parameters. This is done with WSDD

  4. Compile everything and generate GAR file. This is done with Ant

  5. Deploy service. This is also done with Ant

Don't worry if you don't understand these five steps or are baffled by terms such as GWSDL, WSDD, and Ant. In this first example we're going to go through each step in great detail, explaining what each step accomplishes, and giving detailed instructions on how to perform each step. The rest of the examples in the tutorial will also follow these five steps. However, the rest of the examples will simply instruct you to perform a step, and won't repeat the whole explanation of what that step is. So, if you ever find that you don't understand a particular step, you can always come back to this chapter ("Writing Your First Grid Service in 5 Simple Steps") to review the details of that step.

Before we start...

Ready to start? Ok! Just hold your horses for a second. Don't forget to download the tutorial files before you start. You can find a link to the tutorial files in the tutorial website. The tutorial bundle includes all the tutorial source files, plus a couple of extra files we'll need to successfully build and deploy our service. Just create an empty directory on your filesystem and untar-ungzip the file there. From now on, we'll refer to that directory as $TUTORIAL_DIR.

Once you have the files, take into account that there are two ways of following the first chapters of the tutorial:

Ok, now we're ready to start :-)