Java sample code "RestSample.java"
*Sample code using Restlet(http://www.restlet.org/) framework
query = Accession No. [BC019236], output = HIT ID
package hinv;
import org.restlet.Client;
import org.restlet.data.Protocol;
import org.restlet.resource.DomRepresentation;
import org.restlet.util.NodeSet;
public class RestSample {
/**
* @param args
*/
public static void main(String[] args) {
try {
Client client = new Client(Protocol.HTTP);
String url = "http://h-invitational.jp/hinv/hws/acc2hit.php?acc=BC019236" ;
DomRepresentation xml = client.get(url).getEntityAsDom();
NodeSet nsHit = xml.getNodes("//H-Inv/H-INVITATIONAL-ID") ;
for(int i=0 ; i < nsHit.getLength() ; i++){
System.out.println(nsHit.get(i).getTextContent()) ;
}
} catch (Exception e) {
e.printStackTrace() ;
}
}
}
Result
HIT000038568_01
HIT000038568_02