Introduction
WebSphere Integration Developer (WID) is a powerful IDE to develop business processes. A process is developed following the Business Process Execution Language (BPEL) standard.
It goes much beyond just the development of a BPEL process. It allows you to build application integration solutions involving data and interface mapping. In other words, it is a tool to develop integration solutions that follow the Service Oriented Architecture (SOA).
The sheer amount of features in WID v6 can be overwhelming. In this tutorial, we will learn how to build and test a very simple “Hello World” type business process.
Apply Fix Pak
These tutorials were developed after Fix Pak 6.0.0.1 and Interim fix 001 was applied to WID. It is recommended that you do the same. Otherwise, some of the steps may be slightly different.
To apply these fixes, take these steps.
- If WID is currently running, shut it down. Launch Rational Product Updater from the Integration Developer start menu.
- Click on Find Updates. This will first offer you to update the product updater software itself. Accept this offer.
- System will update the product updater software and re-launch it. After the updater tool is re-launched, it will find the available upgrades to WID.
- Click on Install Updates. Depending on your network speed, this can take more than an hour. Finally, make sure that you see the success message shown below.
- Exit out of Rational Product Updater.
Start the Server
Many operations in WID require the server to be running. It is better to start the server before trying to carry out those operations. Otherwise, system will automatically start the server in debug mode. Server performs poorly in debug mode.
Launch WID. Close the Welcome screen. You will be in the Business Integrationperspective by default.
At the bottom of the screen, click on the Servers tab. This will activate the Serversview. Right click on WebSphere Process Server v6.0 and click on Start. It will take a few minutes to start the server.
Create a Business Integration Module
A module is a project where all business process related artifacts are created. From the menubar, select File->New->Project. Expand Business Integration and select Module. Click on Next. Enter SimpleModule as the module name. Click on Finish.
System will create the project and proceed to build the workspace. Watch the bottom right hand corner of the screen for the progress of the build process. Wait for it to complete.
Create the Process
In the Business Integration view, expand SimpleModule->Business Logic.
Right click on Process and select New->Business Process.
Enter the following values.
Module: SimpleModule
Namespace: Accept the default. Folder: procs. It is a good idea to create the processes in a sub folder instead of in the root of the module project. Name: HelloWorld
Click on Next. Choose the Generate a new Interface option.
What is an interface Every business process is also a web service operation. A client of the process can initiate the process by invoking that operation. An interface in WID is an abstract web service defined in a WSDL file (portType). A business process must implement an operation of an abstract web service or interface. In this tutorial, we let the system generate an interface with the same name as the business process (HelloWorld). The generated interface has one operation called operation1 that takes a xsd:string as input and returns xsd:string as output. The simple business process will implement this operation. That is, the process will receive a string as input from the client and return a string back. In later tutorials, we will take a more realistic approach where we will first define our own interface and have the process implement an operation of that interface.
Click on Finish.
Study the Interface
Expand Interfaces and double click on HelloWorld.
Notice that the generated interface has only one operation called operation1. This operation takes a string as an input and returns a string. The data types are XML elements. In this case, string is a predefined data type as per the XML schema specification.
Close the interface view.
Study the Process
The process should be already open in the process editor. If not, expand Processes and double click on HelloWorld.
On the right hand side palette, you see the Variables section. Process variables are used to save state information. A process can run for days. The state information must survive server restarts. System is responsible for persisting variables in a database to preserve the state. A variable called Input1 is already defined in the process. Select the variable.
At the bottom of the screen, activate the Properties view and select the Details tab. Note that the data type of the variable is string. (All data types refer to XML elements or predefined types as per the XML schema specification).
Now, let’s focus on the process editor. You should see two activities already added to the process.
The Receive activity takes input from the client. This is usually the very first activity in a process. The Reply activity sends output back to the caller. This is usually the last activity in a process.
Select the receive activity. In the Properties view, select the Details tab. Note that the Input1 process variable is setup as the input to this activity. This means, after the receive activity is executed, system will save the input to the process in the Input1 variable.
Select the reply activity. In the details section of the property, you should note that the Input1 variable is setup as the output of this activity. This means, the data from the Input1 variable will be sent back to the client of the process.
In the later tutorials, we will define our own variables and configure the request and reply activities to work with these variables. For now, we accept the default settings.
Develop the Process
Our process is very simple. It will print out “Hello World” in the server console.
Click on the activities toolbar button and select the snippets button. The snippet activity allows you to run a few lines of Java code. This activity is great for adding simple debugging and logging statements in the process. Now, click the mouse below the Receive atctivity.
System will add the snippet activity below the receive activity. Change the name of the snippet activity to Say Hello.
While the snippet activity is selected, open the details section of the properties view. Choose the Java radio button. System will open a warning dialog.
Select the Do not ask me this again checkbox. Click on Yes.
In the Java snippet editor enter:
System.out.println("Hello World");
Save changes (Control+S).
Add the Process to the Assembly Editor
A business process is a component. Other types of component include web service, Java class and EJB. The assembly editor allows one to create a composit application by connecting various components. In our case, the process itself is the application. All we have to do is add the process to the assembly editor.
In the Business Integration view, expand SimpleModule. The assembly document is the very first node below the top node and called SimpleModule.
Double click on SimpleModule to open the assembly diagram editor. Drag and drop the HelloWorld process on the diagram. Save changes (Control+S).
Deploy Application to the Server
We must deploy our Business Integration module to the server before we can test it. Make sure that the WebSphere Process Server is running. Right click on it and select Add and remove projects. Add the SimpleModuleApp application. Click on Finish. It will take a few seconds to publish the application to the server.
Watch the progress indicator at the bottom right hand corner of the screen. Wait for the publishing process to end.
Test the Process
Right click anywhere on the assembly editor and select Test Module. System opens up the automated test script editor.
System automatically selects the HelloWorld process as the component and the operation1 of the interface that should be invoked. If you have several processes added to the assembly editor, you may have to manually change these values.
You can enter any input data required by the operation. In our case, we don’t really care about any input data. Simply click on the Continue button to execute the operation1 method and execute the process.
Choose the WebSphere Process Server v6.0 runtime. Select the Use this as the default and do not ask again checkbox. Click on Finish.
Make sure that you see the Hello World message in the Console view.
If you wish to run the process again, right click on the Invoke node in the Eventssection and select Rerun.
Congratulations, you have successfully created a BPEL process and executed it in WID.