Once you install the Server, the full machine-readable service description is available at http://<SERVER:PORT>/taverna-server/services, where SERVER and PORT correspond to the server name and port where you are running the service.

REST Interface

In the following we describe a typical execution example using the REST API. The full user-friendly REST API documentation is also available.

1. Start by creating a workflow run

This is done by POSTing a wrapped t2flow document (or SCUFL2 in the future) to the service at the address http://<SERVER:PORT>/taverna-server/rest/runs.

The wrapping of the submitted document is represented by a single XML element <workflow> in the namespace http://ns.taverna.org.uk/2010/xml/server, and the workflow (as saved by the Taverna Workbench) is its child element.

The result of the POST is an HTTP redirect to the location of the created run, hereby denoted as <RUN_URI>. It includes a UUID which you will need to save in order to access the run again, though the list of known UUIDs can be found above. Note that the run is not yet actually doing anything.

2. Set up the values for the workflow input ports

This is done by either uploading a file that is to be read from, or by directly setting the value.

Directly setting the value of an input

To set the input port, FOO, to have the value BAR, you would PUT a message like this to the URI <RUN_URI>/input/input/FOO:

Uploading a file for one input

The values for an input port can also be set by means of creating a file on the Server. Thus, if you were staging the value BAR to input port FOO by means of a file BOO.TXT then you would first POST this message to <RUN_URI>/wd:

Note that “QkFS” is the Base64-encoded form of string “BAR”, and that each workflow run has its own working directory into which the uploads are placed; you are never told the name of this working directory.

Once you have created the file, you can then set it to be the input for the port by PUTting this message to <RUN_URI>/input/input/FOO:

Note the similarity of the final part of this process to the previous method for setting an input.

You can also create a directory, e.g., IN, to hold the input files. This is done by POSTing a different message to <RUN_URI>/wd:

With that, you can then create files in the IN subdirectory by sending the upload message to <RUN_URI>/wd/IN and you can use the file as an input by using a name such as IN/BOO.TXT. You can also create sub-subdirectories if required by sending the mkdir message to the natural URI of the parent directory, just as sending an upload message to that URI creates a file in that directory.

Uploading a Baclava file

The final way of setting up the inputs to a workflow is to upload (using the same method as above) a Baclava XML file (e.g. FOOBAR.BACLAVA) that contains the inputs. This is then set as the provider for all inputs by PUTting the name of the Baclava file (as plain text) to <RUN_URI>/input/baclava.

3. Start the workflow execution

This is done by using a PUT to set /status to the plain text value Operating.

4. Poll the Server waiting for the workflow to finish

To discover the state of a run, you can (at any time) do a GET on <RUN_URI>/status; when the workflow has finished executing, this will return Finished as opposed to Operating (or Initialized, which is the starting state).

There is a fourth state, Stopped, but it is not supported in this release.

5. Monitor the workflow expiry time

Every workflow run has an expiry time, after which it will be destroyed and all resources (i.e. local files) associated with it on the Server cleaned up.

By default, in this release, this is set to 20 minutes after initial creation. To see when a particular run is scheduled to be disposed of, do a GET on <RUN_URI>/expiry; you may set the time when the run is disposed of by PUTting a new time to that same URI.

Note that this includes not just the time when the workflow is executing, but also when the input files are being created beforehand and when the results are being downloaded afterwards; you are advised to make your clients regularly advance the expiry time while the run is in use.

6. Collect workflow outputs

The outputs from the workflow are files created in the out subdirectory of the run’s working directory. The contents of the subdirectory can be read by doing a GET on <RUN_URI>/wd/out which will return an XML document describing the contents of the directory, with links to each of the files within it. Doing a GET on those links will retrieve the actual created files (as uninterpreted binary data).

Thus, if a single output FOO.OUT was produced from the workflow, it would be written to the file that can be retrieved from <RUN_URI>/wd/out/FOO.OUT and the result of the GET on <RUN_URI>/wd/out would look something like this:

7. Standard output and standard error

These are coming from the Taverna Command Line Tool (that this version of the Server internally wraps) subprocess used internally by the Server to execute workflows and can be read via properties of the special I/O listener. To do that, do a GET on <RUN_URI>/listeners/io/properties/stdout (or .../stderr). Once the subprocess has finished executing, the I/O listener will provide a third property containing the exit code of the subprocess, called exitcode.

Note that the supported set of listeners and properties will be subject to change in future versions of the Server, and should not be relied upon.

8. Delete the workflow run on the Server

Once you have finished, destroy the run by doing a DELETE on {{http://<SERVER:PORT>.rcs.manchester.ac.uk:8080/taverna-server/rest/runs/UUID}}. Once you have done that, none of the resources associated with the run (including both input and output files) will exist any more. If the run is still executing, this will also cause it to be stopped.

All operations described above have the equivalents in the service’s SOAP interface.