Grid Service Discovery
Contributors: Bill Stephens
Overview
This article focuses on Discovery of grid services for Grid client application developers. The instructions are written with the assumption that you will not be building caGrid but only need to obtain the caGrid and Globus Jar files. The code examples, written for the command line, are not specific to any client development framework in order to focus on the functionality that must be implemented rather than actual GUI code.
Discovery of grid services involves the grid Index Service which contains metadata about each advertised grid service. This example will use the caGrid DiscoveryClient to list all available services for a grid and search for services on the grid.
References
Discovery Client Overview to understand grid discovery.
DiscoveryClient Java Doc
Discovery using the Grid Portal
Training Grid caGrid Portal![]()
Accessing Secure Services
You must configure your Globus installation to trust the certificates of grid that you will be accessing.
Sync with Grid Trust Fabric![]()
You must also set the Globus location in the runtime classpath.
Obtaining a list of all services
To obtain a list of all services on the grid we must use the DiscoveryClient and specify the URL of the Index Service.
For the purposes of this code we use the Training Grid Index Service URL. You can interact with the Index Service without logging into the grid.
http://index.training.cagrid.org:8080/wsrf/services/DefaultIndexService
getAllServices
DiscoveryClient discoveryClient = new DiscoveryClient(indexServiceURL); EndpointReferenceType[] allServices = null; try { allServices = discoveryClient.getAllServices(true); } catch (RemoteResourcePropertyRetrievalException e) { // TODO Display appropriate client error e.printStackTrace(); } catch (QueryInvalidException e) { // TODO Display appropriate client error e.printStackTrace(); } catch (ResourcePropertyRetrievalException e) { // TODO Display appropriate client error e.printStackTrace(); }
The getAllServices input parameter:
if true, only services providing the standard metadata will be returned.
if false, all services registered will be returned, regardless of whether or not any metadata has been aggregated.
Searching for Services
Many DiscoveryClient methods exist to allow you to obtain collections of grid services. Our example uses the discoverServicesBySearchString method and the term "Gene".
discoverServicesBySearchString
DiscoveryClient discoveryClient = new DiscoveryClient(indexServiceURL); EndpointReferenceType[] searchedServices = null; try { searchedServices = discoveryClient.discoverServicesBySearchString("Gene"); } catch (RemoteResourcePropertyRetrievalException e) { // TODO Display appropriate client error e.printStackTrace(); } catch (QueryInvalidException e) { // TODO Display appropriate client error e.printStackTrace(); } catch (ResourcePropertyRetrievalException e) { // TODO Display appropriate client error e.printStackTrace(); }
Example Code
The attached file provides an example command line login client and a listing of Globus and caGrid Jar files required to compile and execute the example.
Grid DiscoveryClient, properties and Jar Dependency List![]()





