WORKING WITH SIMPLE DATA TYPES FROM A PROCESS IN WEBSPHERE INTEGRATION DEVELOPER 6 TUTORIAL
A BPEL business process can receive input data and send output data to the invoker of the process. In WebSphere Integration Developer (WID), the type of the input or output data must be a valid XML element or a predefined XML data type (such as xsd:double or xsd:string).
This tutorial builds on WASKB019 Creating a Basic Business Process in WebSphere Integration Developer 6. You must complete that tutorial first.
THE BUSINESS PROBLEM
At this point, the HelloWorld process simply prints out a message in the console. We will change the process to accept the name of a person as input and reply a greeting as the output. In both cases, we will work with the string data type.
CREATE NEW VARIABLES
Launch WID if it is not already started. Start the WebSphere Process Server v6.0.
In the Business Integration view, expand SimpleModule->Business Logic->Processes. Double click on HelloWorld to open the process in the process editor.
In the right hand side palette, locate the Input1 variable.
Select the variable. Click on the X icon to remove the variable.
Click on the + icon to add a new variable. Change its name to fullName. At the bottom of the screen activate the Properties view. Click on the Details tab. Next to Data Type click on Browse. Select string and click on OK.
Similarly, add another variable called greeting and set the data type to string.
Save changes (Control+S). System will begin building the workspace. There will be an error message since, parts of the process are still referring to the deleted variable Input1. Ignore this message.
CONFIGURE THE INPUT AND OUTPUT OF THE PROCESS
Select the Receive activity in the process editor. In the Properties view, click on the Details tab.
At the right end of the Input(s) row, click on the … button as shown above. Choose the fullName variable and click on OK. This will cause the system to save the input data in the fullName variable.
Similarly, select the Reply activity and from the details property page, set the greeting variable as the output.
CHANGE THE SNIPPET
Select the Say Hello snippet activity. In the Properties view, select the Details tab. Change the snippet code to as follows.
greeting = "Hello " + fullName;
Save changes. Use the Problems view to make sure that there are no compilation error.
TEST THE PROCESS
We made a few changes to the process. It is safe to restart the application before testing the process. In the Servers view, right click on the server and select Restart Project->SimpleModuleApp. Watch the botton right hand corner for the progress of the publishing process. Wait for it to complete.
Open the assembly editor by double clicking on SimpleModule->SimpleModule. Right click anywhere in the diagram and select Test Module.
In the Initial request parameters table, set the input1 data to John Doe as shown above. Click on Continue.
Select the Return node in the Events tree view area as shown above. Make sure that the output1 field of the reply data shows “Hello John Doe”.
To run the test using another input data, click on the Invoke toolbar button in the top right hand corner of the test script editor window.
Enter a new value for the the input1 filed of the input data and click on Continue.
In this tutorial, you learned how to:
- Declare new process variables.
- Setup a process variable to recieve the input to the process.
- Setup a process variable from where the output data of the process is constructed.
- Enter input data during unit test.
- Review the output data during test.
Later, we will learn how to work with more complex data structure. The basic steps will be same as what we have learned here.