WebServices Plugin

From user's Wiki!
Jump to: navigation, search

This plugin provides a Web Services HTTP server that exposes all available command line plugins using Web Services interface.

For users

Server can be started accessing to the Preferences window:

Preferences window

When starting the server, it will use the default port and URL: http://localhost:9090/axis2/services/wsGimias?wsdl

When using Taverna, you need to import a new WSDL service and specify this address. You will see the available command line plugins in Taverna service panel. You can create your own workflow using the available filters.

Taverna workflow

To execute the workflow, remember to set output file names to the output of each filter. For example, we need to specify the input "outputVolume" for the filter Read_DICOM. This will be the output file name used to save the results of the filter.

Note Note: Importing a WSDL Service in Taverna

To import a WSDL service in Taverna you can follow this steps WSDL. You should set the time out properly depending on the network timeout and the process execution time.

To configure the server parameters you need to click on Configure button.

Server configuration

Here you can configure:

  • Server Port: Port of the server for service registry and service provider. When GIMIAS deploys the services, it acts as a service registry, because it's the server that provides the WSDL file with the list of all services. The same server is also acting as a service provider, waiting for a WS request.
  • Service Provider IP address: Is possible to redirect the service provider into another computer
  • Service provider Port: Is possible to redirect the service provider into another computer

For developers

Web services uses AXIS2C library to create the HTTP server.

Two files will be created before starting the server:

  • serfices.xml: List of all available services
  • wsGimias.wsdl: interface for each service

The interface of the available services is created using all ModuleDescription instances from all plugin providers of type CommandLineModule or ProcessorModule.

The available functionalities that can be deployed as web service are:

  • Command line plugin: This service doesn't use graphical interface. All command line plugins can be deployed as web services by default.
  • Processor: This service doesn't use graphical interface. All Processors can be deployed as web services, adding an XML file and the function SetParameter() for the processor.
  • Worfklow with user interaction: To create a web service of this type, you need to create an XML file of the first and last step of the workflow.

The server is implemented using a separate thread implemented in the class WebServerThread.

A wxEvtHandler is used to receive events from the thread and update the UI.

The server expects the following folder structure that will be created in the application data:

wsrepo/modules/
	addressing/
		axis2_mod_addr.dll
		module.xml
	logging/
		axis2_mod_log.dll
		module.xml
wsrepo/services
	wsGimias/
		services.xml
		wsGimias.dll
		wsGimias.wsdl
wsrepo/axis2.xml

Server code is implemented in a separate project called wsGimias. The generated DLL will be wsGimias.dll that will be called when there's a web service request.

When a request is received, the server calls the class wsModuleExecution. This class is responsible of:

  • Finding the requested operation and retrieve the ModuleDescription
  • Transferring parameters values from the request to ModuleDescription class
  • Execute the operation
  • Retrieve output values and create a web service response

The execution of the operation is performed creating an instance of DynProcessor. This processor executes a ModuleDescription. Depending on the type of ModuleDescription, a different execution implementation will be called:

  • Command line plugin: ModuleExecutionCLPExe
  • Processor: ModuleExecutionProcessor
  • Worfklow with user interaction: ModuleExecutionWorkflow

When the ModuleDescription is executed, there are three steps:

  • PreProcess: Preprocess input data for execution
  • Execute: Execute operation
  • PostProcess: Post process output data

Depending on the type of web service, pre process and post process will have different behavior that is implemented by a subclass of the interface DynDataTransferBase.

Version 1.4.2

@neurist morphological workflow has been used as an example for testing the web services with and without user interaction.

Simplified @neurist workflow

Multiple requests to the server are available because the server creates a new thread for each request.

You can see a video here.

REST

REST interface is also available for all web services. It has been tested with Taverna. It uses PUT method to execute an algorithm.

Rest service execution

To execute a web service using REST interface, you should use PUT method and use this URL:

http://localhost:9090/axis2/services/wsGimias/<operation>. 

For example, to execute Gaussian Blur, the URL is http://localhost:9090/axis2/services/wsGimias/Gaussian_Blur

The input should be an XML text containing the values of the parameters. For example:

<ns1:Gaussian_Blur xmlns:ns1="http://ws.apache.org/axis2/services/wsGimias ">
  <inputVolume>P:\Data\Angio\SimpleAneuristWorkflow\volumeCropped.vtk</inputVolume>
  <outputVolume>P:\Data\Angio\SimpleAneuristWorkflow\volumeCroppedBlurred.vtk</outputVolume>
  <sigma>5.0</sigma>
</ns1:Gaussian_Blur>

Remote data

In order to execute a web service, remote data should be enabled when the web service is executed in a remote computer (as usual). The plugin RemoteDataPlugin, allows the download and upload of remote data.

Future work

  • Develop Web services plugin provider
  • Start GIMIAS server without GUI
  • Add web service documentation in WSDL

Go back to Users