your web services to corresponding RESTful services. Contact us with any questions
Developing for the RCSB PDB Web Services: Writing a Java client
There are several ways to build applications that use web services. This example will demonstrate using web services with Java Axis.
First download axis for Java (http://ws.apache.org/axis/java/releases.html). You should now have a folder that contains the axis distribution. At the time of this tutorial this is axis-1_4.
The best approach is to use axis with Ant (http://ant.apache.org/bindownload.cgi) and even better is to integrate it with Eclipse (http://www.eclipse.org/downloads/). Setting this up is beyond the scope for the moment.
Make sure you have the latest version of java.
On a command line type the following:
You should see something that indicates a version greater than 1.3.
Cygwin
This tutorial uses bash shell in cygwin. If you do not have cygwin, download it from (http://www.cygwin.com/) and click the Òinstall cygwinÓ icon.
Generate Java stubs
Now we are ready to generate the Java stubs from the Web Services WSDL file located on the PDB web site. On the command line run the following:
This is a long command and this is where Ant and Eclipse come in handy. However, this will convert the PDB WSDL file located at http://www.pdb.org/pdb/services/pdbws?WSDL into a Java stubs package.
If you look in the directory (e.g. type ÒlsÓ ) you will see a new directory that contains the package of all the new Java files.
Build Application
Now we are ready to build our web services Java application. For the purposes of this demonstration we will make this a very simple application that retrieves the secondary structure for a set of PDB chain IDÕs.
The first thing we need to do is to create a web service locator object. If we look in the package that was generated we will see that there is a file called PdbWebServiceServiceLocator.java. This is the locator object. In the source we simply instantiate this:
From this we can retrieve the PDB web services for a particular physical location using a URL.
Now we have the PdbWebService object that allows us to make our calls. If you have not already figured this out, this PdbWebService object is located in the axis-generated package and viewing this file (PdbWebServices.java) allows you to see all the available web services through a Java interface.
Source code
Here is the source for a simple Java client that gets the secondary structure in ASCII format:
Compile this Java file using JDK (Java Development Kit 1.4 or greater):
(make sure you are in the directory where axis is. In other words make sure the classpath is correct).
Run the Java program:
Where the secondary structure ASCII output for the Kabsch & Sander algorithm looks like the following:

