[ Japanese ]

Here is the tutorial of H-InvDB Web service.

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

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 service to develop the application using H-InvDB Web service.

2. What service is available?

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

3. How to use the service?

H-InvDB Web service provide REST-APIs and SOAP-APIs.

To connect to the REST service 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 service, please call the method and parameters to [
http://jbirc.jbic.or.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.

To connect to the SOAP service, please use SOAP library of programing languages.
Please access the following to connect to WSDL.
http://h-invitational.jp/hinv/hws/API?wsdl

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 service, 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://jbirc.jbic.or.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://jbirc.jbic.or.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".

6. Sample Program

Here are the sample codes with SOAP or REST APIs.

  1. Perl sample code with REST
  2. PHP sample code with REST
  3. Ruby sample code with REST
  4. Java sample code with REST
  5. Perl sample code with SOAP
  6. PHP sample code with SOAP
  7. Ruby sample code with SOAP
  8. Java sample code with SOAP