4.1: Web Services Tutorial Overview
In order to compose this simple, one-service process in JOpera for Eclipse, the following steps need to be completed:
- A new JOpera Project needs to be created
- The WSDL description of the Web Service needs to be imported
- A new process needs to be defined and input and output parameters need to be added
- A program (resulting from the WSDL import) needs to be added to the process
- The data flow connections need to be drawn
- The process then needs to be compiled (by saving it) and run
- Finally, the execution of the process needs to be monitored
You can watch a video corresponding to this tutorial here:
http://www.jopera.org/docs/videos/ws
.
4.2: Creating a new Project
In order to create a new Project, right-click in the JOpera Navigator
Figure 4.1: Creating a new JOpera project
and select
New > JOpera Project
. Choose an appropriate "Project name" ("test" in this case) and click on the "Finish" button.
4.3: Importing a WSDL File
As soon as the new project has been created, right-click on the newly created project. Select "Import..." from the context menu and subsequently choose the "new WSDL Import" from the Import dialog and click on next. On the next dialog
Figure 4.2: Defining the URL of the WSDL file
define the project name (if not already defined) and the URL of the WSDL description file of the Web Service which is to be imported. The Web Service used in this tutorial is a simple temperature reporting service which can be found at:
http://www.xmethods.net/sd/2001/TemperatureService.wsdl
Note:
XMethods has become very unreliable recently. If you have trouble with the above Web service, you may want to look for a similar alternative at:
http://webservices.daelab.net/temperatureconversions/TemperatureConversions.wso?WSDL
Clicking on "Finish" will finally import the Web Service description.
4.4: Creating a new Process
Double-clicking on the newly created OML file will show all the defined processes and programs in this OML file in the "Editor". Importing the WSDL file creates a new program for each of the Web Services operations. Thus no processes are defined yet.
Figure 4.3: Adding a new Process
Adding a new process is done by clicking on the "Add..." button right next to the "Processes" section. Doing so will create a new process called "NewProcess".
4.5: Adding Input/Output Parameters
Double-clicking (or clicking on the "Edit" button) on the newly created process will give you are more detailed view, showing the process' parameters, tasks as well as data and control flows. The first thing you may want to do is to change the name of the process (to maybe "getTemperature"). What needs to be done further is adding the input and output parameters. In this simple case only one input and one output parameter is required. Add these by clicking on the "Add..." button right in the "Parameters and Constants" section. Rename them appropriately.
Figure 4.4: Adding Input and Output Parameters
This may be a good time to become familiar with the "Problems" view. JOpera is periodically analyzing the processes and programs you are defining and will report problems discovered in the "Problems" view.
Figure 4.5: Problems reported in the Problems view
There are basically two problems with the process defined so far: it does not contain any tasks and the input and output parameters are disconnected, meaning that they need to be connected in the data flow. We will fix both problems in the next two sections.
4.6: Populating the Process
After having created the process, it's now time to populate it with tasks. In order to do this you can simply drag programs from the "Outline" view and drop them on the data flow of the process you wish to populate.
Note:
If you have switched on versioning support, you will need to open the outline nodes representing the program and drag the node corresponding to its version In the case of this tutorial, the getTemp
program is added to the process.
4.7: Draw Data Flow Connections
In order to draw the data flow connections, you first have to switch to the "Data Flow" view of this process. Then the input and output parameters of the process need to be displayed. Displaying the parameters can be done by right-clicking on the process boxes and selecting "Show All Parameters" in the context menu.
Figure 4.6: Displaying the Parameters of a Process
As soon as this has been done, the input parameters of the process need to be connected with the input parameters of the task. The same is true for the output parameters: the output parameters of the task need to be connected with the output parameters of the process. To do this, right-click in the view and choose "Connection Tool" in the context menu. Now simply connect the appropriate boxes by clicking on them.
Figure 4.7: Complete Data Flow of the Sample Process
In case of this simple process the control flow is defined implicitly.
4.8: Compilation of the Process
Compilation of the process is simply done by saving the OML file. Given that there are no problems (check the "Problems" view), the process should be compiled upon saving the corresponding OML file. All you need to make sure is that in the menu "Project", "Build Automatically" is selected. Alternatively you can compile the process by selecting "Build All" in the "Project" menu.
4.9: Executing and Monitoring the Process
In order to run a process, switch to the overview page, select the process name you want to start and then click on the Start
button. Make sure that the oml file has been saved. If the process has never been run before an Eclipse launch configuration dialog will be opened and you can use it to specify the process input parameter values. The process will be started as soon as you click on Run
.
The next time you start the process, it will be immediately executed. If you want to change the input parameter values, you should use the Run...
menu and look for the launch configuration corresponding to your process.
Figure 4.8: Executing the Sample Process
Monitoring the progress of the execution is done by switching the Editor into the monitoring mode. In order to do so, simply click on the
Monitor Mode
button. You need to have either the Data Flow or Control Flow opened in order to switch into monitor mode.
Figure 4.9: Switching to Monitor Mode
Refer to
Figure 4.9 in order to find the button. As soon as you have switched to the monitoring mode, you are no longer able to edit the process. In order to monitor and debug execution of the newly composed process, you need to run it exactly as outlined at the beginning of this section. If you do so, the boxes of the process and tasks will be colored with respect to their current state.
Figure 4.10: Monitoring a Running Process
This means they will be colored orange shortly after the process has been started, indicating that they are running as depicted in
Figure 4.10. If the process or the task finishes successfully, the boxes will be colored blue.
Figure 4.11: Successfully finished Process
Errors or failures will be colored red. In order to inspect the result of the execution of either a task or a process, simply click on the box and check out the properties view. The properties view will show you the result or possible error messages.
Figure 4.12: Properties of a Finished Task (Tip: to display all of these properties you should press the 'Advanced' button in the view's toolbar)
Alternatively you may want to open the
Kernel Memory Inspector
view by selecting it in the
Window
,
Show View
menu. The
Kernel Memory Inspector
shows you all data in the kernel's memory. This includes the input as well as output parameters of the processes and tasks, the state of each process and task and more. The state of each process and task is also highlighted by a the colors blue, red and yellow indicating that a process or task has finished successfully, failed or is still in progress respectively.
Figure 4.13: Monitoring the Sample Process in the Kernel Memory Inspector