[ Japanese ]

3.4 H-InvDB web servise

Here is the tutorial of H-InvDB Web service.

  1. What is H-InvDB Web service?
  2. What servise is available?
  3. How to use the servise?
  4. How to call a method with parameters including non_alphanumeric character?
  5. How to call a method with asynchronousu?

1. What is H-InvDB Web service?

H-InvDB Web service provide the various APIs to use H-InvDB data.
Any one can use the servise to develop the application using H-InvDB Web service.

2. What servise is available?

H-InvDB Web service provide 12 APIs.
Please refer below for the details;
List of REST APIs
List of SOAP APIs

3. How to use the servise?

H-InvDB Web service provide APIs of REST protocol.
To connect to the REST servise you need an environment of HTTP connection (e.g. web browser) and the programming language (e.g. Perl or JAVA).
To use the H-InvDB Web servise, please call the method and parameters to [
http://h-invitational.jp/hinv/hws/keyword_search.php?query=cancer] as below;
The POST method access are approved, but the GET method may also be possible if you use the parameters below the limit of data transfer of GET method.

4. How to call a method with parameters including non_alphanumeric character?

If you call a method with parameters including non_alphanumeric charactors, e.g. "Homo sapiens", please encode as below;
(JAVA sample)
String query = "query=" + URLEncoder.encode("Homo sapiens","UTF-8");
		

5. How to call a method with asynchronous?

You need to keep holding the connection while you use the REST protocol, but may also call a method with asynchronous.
It will save the resource of your client PC by calling a method with asynchronous.
We introduce you the way of asynchronous call by using LWP.
The method wih "Async" at the end (e.g. keyword_search) are the method for asynchronous.
Step1. Call asynchronous service.
	
use LWP::UserAgent;
$ua = new LWP::UserAgent;

# make request
my $req = new HTTP::Request POST => "http://h-invitational.jp/hinv/hws/keyword_search.php";
$req->content_type("application/x-www-form-urlencoded");
# set parameters
$req->content("query=HIT00002218*&start=1&end=100");

# send request and get response.
my $res = $ua->request($req);

# show response.
print $res->content;
	
The out put will be as below;
Your requestID is:20070717144558241
	
To get a result, call RequestManager with your request ID

Step 2. Get a result.
use LWP::UserAgent;
$ua = new LWP::UserAgent;

# make request
my $req = new HTTP::Request POST => "http://h-invitational.jp/hinv/hws/keyword_search.php";
$req->content_type("application/x-www-form-urlencoded");
# set parameters
$req->content("query=HIT00002218*&start=1&end=100");

# send request and get response.
my $res = $ua->request($req);

# show response.
print $res->content;
	
If your job has completed you will get the actual result of a service, otherwise you will just get the message "Your job has not completed yet".

Revised: December 26, 2007