Project

General

Profile

Revision 1813

Added by Jing Tao over 17 years ago

A sample application program to call metacat string service.

View differences:

src/edu/ucsb/nceas/metacat/stringclient/application/MetacatStringServiceApplication.java
1
package edu.ucsb.nceas.metacat.stringclient.application;
2

  
3
import edu.ucsb.nceas.metacat.stringclient.MetacatString.MetacatStringServiceLocator;
4
import edu.ucsb.nceas.metacat.stringclient.MetacatString.MetacatStringPortType;
5
import java.net.URL;
6

  
7
public class MetacatStringServiceApplication
8
{
9
	public static void main(String[] args)
10
	{
11
		try
12
		{
13
			// Get command-line arguments
14
			String docid = args[1];
15
			URL GSH = new java.net.URL(args[0]);
16

  
17
			// Get a reference to the remote web service
18
			MetacatStringServiceLocator metacatService 
19
                                    = new MetacatStringServiceLocator();
20
			MetacatStringPortType metacat = 
21
                              metacatService.getMetacatStringService(GSH);
22

  
23
			// Call remote method 'add'
24
                        String message = metacat.read(docid);
25

  
26
			// Print result
27
			System.out.println(message);
28
		}catch(Exception e)
29
		{
30
			System.out.println("ERROR!");
31
			e.printStackTrace();
32
		}
33
	}
34
}
0 35

  

Also available in: Unified diff