| Tutorial - Service invocation plugin | ||||
|---|---|---|---|---|
|
|
|
|
|
|
This is part of the tutorial Tutorial - Service invocation plugin
- Previous step: 1. Create project from archetype
- Next step: 3. Configuring the service instance
Testing the service in Taverna
You have already created a new project from the Taverna service archetype, but before we change anything, we'll dive right in and check how the new service type will appear in Taverna.
We won't go into making the plugin description and installation yet, so we will cheat and just trick our new plugin onto the classpath of a dummy version of Taverna. Open the example-activity-ui project, and browse to src/test/java where you should find the class uk.ac.manchester.cs.img.myfancytool.taverna.ui.TavernaWorkbenchWithExamplePlugin.
The main method of this class will start the Taverna workbench through the net.sf.taverna.raven.launcher.Launcher, included from the taverna-dev artifact as a test dependency. This developer version of Taverna does not use the Raven plugin system, just a single classpath. To avoid conflicts, most service types like WSDL and BioMart are therefore disabled (using exclusions in pom.xml). This workbench can't open Taverna 1 workflows, and although you can save workflows, they won't open in a 'real' Taverna installation as the workflow definitions won't include the plugin details.
Open TavernaWorkbenchWithExamplePlugin and click Run->Run to run the test workbench.

Configuring workflow diagram
As the workbench starts up, you might notice that the Available service panel is not as populated as in the official distribution, and that the diagram is missing.

As we are not running Taverna from a normal installation folder, it is not able to locate the GraphViz dot program. We will go to the Preferences (File->Preferences... or on OS X TavernaWorkbenchWithExamplePlugin->Preferences...) and select the Workbench tab.

Click the folder next to Dot location to specify the dot location.
For Windows, navigate inside a Taverna installation to find dot.exe, like C:\Program Files (x86)\Taverna Workbench 2.1.0\bin\win32i386\dot.exe

For OS X, navigate inside the /Applications/Taverna 2.1.app application bundle and find Contents/MacOS/dot.

Once you have Applied and Closed the preferences, click File -> Close workflow to force a refresh of the diagram, it should turn blank if everything works.
Building example workflow
Now have a look at the Service panel, you should find a folder _Example http://localhost:8192/service_
- this is our example service. (The URI is just for show-off - there would not be anything running on localhost:8192).
| Services not showing? If the Examples folder is not showing, this could be due to a bug in Eclipse when it is compiling your example-activity-ui project. Occasionally it will not copy the content from src/main/resources to target/classes - meaning that the SPI files Taverna use to discover your service are not installed. This is due to a conflict between Eclipse's built in builder and the Maven builder. You can work around this by right-clicking the example-activity-ui project and do Run as -> Maven install, but to avoid this permanently, go to Project -> Properties and under Java Compiler -> Building make sure under Output Folder that Scrub output folders when cleaning projects is unchecked. (You would then need to do Project -> Clean if you later move/delete classes or resources) |

Select Examples 1 and drag it onto the Workflow diagram. Right click and select Show ports.

First right click on the firstInput input port (or select it by expanding Examples_1 in the Workflow explorer. Select Constant value and set a constant Hello or similar.

Then right click on simpleOutput and select Connect as input to... -> New workflow output port.... Click OK for the suggested name. Repeat for the port moreOutputs.

The workflow should now be ready to run. Select File -> Run workflow.... As we did not create any workflow input ports, no additional data is required, and the workflow execution should start immediately, and you should get the results Value 1 and Value 2 on the moreOutputs port, and simple on the simpleOutput port.

The workflow was executed using your newly generated service implementation. Next, we'll dig into what the code behind this example activity actually does.
This is part of the tutorial Tutorial - Service invocation plugin
- Previous step: 1. Create project from archetype
- Next step: 3. Configuring the service instance