Grid Services with Service Data
Service Data is a structured
collection of information that is associated to a Grid Service. This
information must be easy to query, so Grid Services can be classified
and indexed according to their characteristics.
An illustrative example is provided here. In this example, a Calculator Grid Service
is created with additional Service Data.
The Service Data includes
details like version, author, last operation performed, etc.
Step 1: Creating the Grid Service from GWSDL
In order to create a Grid Service with Service Data, some changes are
made to the .gwsdl file of the
service.
First, two new namespaces are added: xmlns:data
and xmlns:sd.
The first corresponds to the Service Data Element type and the second
namespace is an OGSI namespace which contains a set of service
data-related tags.
Next, the schema file CalcDataType.xsd
with the description of the new Data Type is imported. For example, in Calc.gwsdl, we describe CalcDataType.
Finally, we add a new tag named <sd:serviceData>
inside the <gwsdl:portType>
tag.
Next, an ant buildfile is used
to create a Top Down Grid Service
using this .gwsdl file. For
example, build.xml is used to create the Calculator Service using Calc.gwsdl by executing the following
command:
[purshah@danube mytry]$ ant
createTopDownGridService
The corresponding output is shown in build_output.txt.
Step 2: Changes in the Implementation
Add whatever functionality is to be implemented within the operations
of the Grid Service. And changes need to be made to the Grid Service Provider that implements OperationProvider
and GridServiceCallBack.
These changes are mainly with respect to Service Data.
For example, in CalcProvider.java, all
the changes are marked with a comment //
Added by Purvesh.
Step 3: Create a GAR
Create a Grid Service Archive (GAR) for the service.
For the Calculator Service, this is done using the command:
[purshah@danube
mytry]$ ant topDownGar
The corresponding output is shown in gar_output.txt.
Step4: Deploy the Grid Service
In your GTK3.0 directory, use the command ant deploy
-Dgar.name=<path to gar created in previous step> to deploy the Grid Service.
For example, the Calculator Service is deployed using the following
command:
[purshah@danube
test_install_dir]$ ant deploy
-Dgar.name=/home/purshah/test_install_dir/mytry/servicedata/servicedataCalcService.gar
The corresponding output is shown in deploy_output.txt.
Step 5: Run the Grid Service
Once the service is deployed, start the container in GTK 3.0. This is
done by using the command ant
startContainer from the GTK 3.0 directory.
Then in another window, create an instance of the Grid Service using java
org.globus.ogsa.client.CreateService <service-url> <id>.
In this command, <service-url>
is the Grid Service Handle (GSH) of the Grid Service Factory that must
produce an instance of the Grid Service called <id>.
For example, an instance named calc is created when the following
command is executed:
[purshah@danube
test_install_dir]$ java org.globus.ogsa.client.CreatService
http://localhost:8080/ogsa/services/services/Calc/CalcProviderFactoryService
calc
The corresponding output was as follows:
Termination Time:
infinity
Created service
with reference:
<definitions
name="CalcService" targetNamespace="http://Calc/service"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:calcservicebinding="http://Calc/bindings"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"><import
location="http://156.56.104.61:8080/schema/services/Calc/Calc_bindings.wsdl"
namespace="http://Calc/bindings"/><service name="CalcService"
xmlns:gsdl="http://ogsa.globus.org/"><gsdl:instanceOf
handle="http://156.56.104.61:8080/ogsa/services/services/Calc/CalcProviderFactoryService/calc"
xmlns=""/><gsdl:instanceOf
handle="http://156.56.104.61:8080/ogsa/services/instance"
xmlns=""/><port
binding="calcservicebinding:CalcServiceSOAPBinding"
name="CalcServicePort"><soap:address
location="http://156.56.104.61:8080/ogsa/services/services/Calc/CalcProviderFactoryService/calc"/></port></service></definitions
Step 6: Create and use Clients
A client must be created that can access the Service Data of the Grid Service.
For the Calculator Service, a client called CalcClient.java
is written.
Now, compile and run CalcClient.java as
follows:
[purshah@danube
notification]$ javac client/CalcClient.java
[purshah@danube
notification]$ java client.CalcClient
http://localhost:8080/ogsa/services/services/Calc/CalcProviderFactoryService/calc
Then the following message should be displayed:
Version: 0.0
Author: purshah
Previous operation: NONE
# of operations: 0