How to use Whatizit Web Services in Java

By | November 13, 2015

Whatizit is a text processing system that allows you to do textmining tasks on text. It is also available as a Web Service whose underlying idea is to ensure that software from various sources work well together. Whatizit is built on open standards of Simple Object Access Protocol (SOAP) and Web Services Description Language (WSDL). For the transport layer itself, Web Services uses most of the commonly available network protocols, especially Hypertext Transfer Protocol (HTTP). For more information on WSDL please refer to the W3C WSDL v1.1 Document.

To use Whatizit web service, you need a directory structure like the following:

  • whatizitws/core/SoapClient.java. Download from Whatizit example Web Services client)
  • jaxws-ri. Download from JAX-WS. You need to download the zip file and extract it in the directory. You will have a new directory jaxws-ri with all the necessary jars in jaxws-ri/lib and scripts in jaxws-ri/bin.
  • generated (An empty folder)
  • src (An empty folder)
  • whatizit.wsdl. Download from Whatizit’s WSDL. You need to rename it
  • server-binding.xml. Download from server-binding.xml.

set PATH shell environment variable pointing to jaxws-ri/bin, you will be able to execute:

wsimport.sh -p whatizitws.client -s src -b server-binding.xml \
  -d generated whatizit.wsdl

which will generate the Stubs. The actual source code for the Stubs can be found in the src folder. The actual class files for the Stubs can be found in the generated folder.

To use the webservice, we firstly need to check out the available pipelines. The description of each individual task/pipeline can be found at http://www.ebi.ac.uk/webservices/whatizit/info.jsf.

To list available pipelines, uncomment line 49-57, then compile and run the client

javac -extdirs jaxws-ri/lib -cp generated whatizitws/core/SoapClient.java
java -Djava.ext.dirs=jaxws-ri/lib -cp generated:. \
  whatizitws.core.SoapClient 

You will get a list of available pipelines, such as

PipelineName: whatizitUkPmcDisease
Description: 
Available: true

PipelineName: whatizitMeshUp
Description: MeshUp annotation
Available: true

PipelineName: whatizitUkPmcGenesProteins
Description: 
Available: true
...

Then pick the pipeline name and try contact, queryPmid, and search in SoapClient.java by replacing the pipelineName at Line 60.

2 thoughts on “How to use Whatizit Web Services in Java

  1. sdarra

    Hi Yifan,
    Thanks for the post. I am getting an error : package com.sun.xml.ws.developer and package whatizitws.client does not exist when I try to run the last step of running SoapClient.java
    Do you have any hint for that?

    Thanks

    Reply
    1. Yifan Peng Post author

      “com.sun.xml.ws.developer” should be in “jaxws-ri/lib” if you follow the previous steps. “whatizitws.client” should be in “generated\whatizitws\client”. If you could found those, probably you didn’t follow up the previous step precisely and didn’t generate the class files.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *