Python Opal Web Service Client: Version 1.9.3

1. Overview

This distribution contains the WSDL for the Opal Web service toolkit, and a sample Python client that invokes a PDB2PQR service that has been deployed via Opal on our production cluster. Alternatively, you could follow the documentation for the server-side installation of Opal here, and deploy a PDB2PQR service yourself.

2. Prerequisites

The Python client should work on both Unix and Windows platforms as long as you have the following packages installed.

  1. Python 2.3 or higher: Download and install Python from, if you don't have a Python installation on your local machine. Add the Python bin directory to your environment variable PATH.

  2. ZSI 2.1_a1: ZSI is a SOAP and Web services toolkit for Python. Download ZSI from SourceForge. If you are installing on a Unix platform, you would need to use a sudo or root shell. Change to the ZSI-2.1-a1/ directory that is extracted from the tarball, and execute the following command:
    python install

    Note the location where the ZSI package is installed. In particular, note the location of the wsdl2py script that we need to use in the future. Typically, the packages are installed inside the Python installation. On Windows, wsdl2py typically resides inside $PYTHON_HOME/scripts, where PYTHON_HOME represents the location of the Python installation. On Unix, it is usually inside $PYTHON_HOME/bin. Henceforth, we will refer to this location as WSDL2PY_HOME.

    Opal will not work with any other version of ZSI. Please ensure that you are using ZSI version 2.1-a1..

3. Installation

  1. Download the Python source distribution for installation from here, if you don't have the appropriate version already.

    Expand the tarball that you have downloaded using the GNU tar utility, as follows:
    tar zxvf opal-py-$VERSION.tar.gz

    This should create a new directory called opal-py-$VERSION/ where all the sources are expanded. Henceforth, we will call this directory OPAL_PY_HOME.

  2. Generate the stubs from the WSDL file with the following command inside the $OPAL_PY_HOME directory:
    $WSDL2PY_HOME/wsdl2py wsdl/opal.wsdl

    This generates two useful files - and The former contains the stubs required to communicate with the remote Web service, while the latter contains the types defined in the WSDL for the service.

4. Running the Client

A sample Opal client is shown in $OPAL_PY_HOME/ It shows how to retrieve a reference to a remote Web service port, set parameters, and invoke remote operations. To launch the remote PDB2PQR service, the argument string (--ff=amber sample.pdb sample.pqr) and the list of input files (etc/sample.pdb) are sent over. The service returns a jobID that is used later to query for status and retrieve locations of the output files. Alternatively, the service can also be invoked in a blocking fashion, where the client blocks until the remote execution is complete, and the outputs are returned as a response to the same invocation.

To run the client, you can run the following command from inside the $OPAL_PY_HOME directory.

By default, the client uses the Web service running on To change this location, modify the URL inside

5. Security

The Opal Web service can be optionally set up to accept connections using GSI-based HTTPS documentation for instructions). The following snippet of code from shows how to access a secure Opal service from Python.
# set the locations for the X509 certificate and key cert = "/Users/sriramkrishnan/certs/apbs_service.cert.pem" key = "/Users/sriramkrishnan/certs/apbs_service.privkey" ... # example of ssl invocation appServicePort = appLocator.getAppServicePortType( baseURL + "opal/services/Pdb2pqrServicePort", ssl=1, transdict=dict(cert_file=cert, key_file=key), transport=httplib.HTTPSConnection) ...

Note that if you are using proxy certificates, they have to be RFC 3820 compliant. This can be done by creating a Grid proxy using grid-proxy-init -rfc (only works for Globus Toolkit 4.0.x). This has only been tested with OpenSSL version 0.9.7g, and may not work with older versions.

6. Feedback

Please use the Opal Toolkit Tracker on Sourceforge to report bugs and feature requests, and the NBCR Web Services User Forum for general comments and feedback.