The Quick Start guide explains how to set up and start the WSO2 BPS, model a BPEL process, deploy and test it using the WSO2 BPS management console. The guide has the following sections:
Setting up the BPS
WSO2 BPS setup is very simple. While more detail of the installation can be found in the Installation Guide, we have given below a basic summary to get you started fast.
1.Ensure that the following are installed in your environment.
- JDK 1.6.* or higher.
- JAVA_HOME environment variable is set to <JDK_HOME>. For example,
JAVA_HOME=c:\Program Files\java\jdk1.6.0_27
.
2. Download the BPS binary distribution from http://dist.wso2.org/products/bps/3.0.0/wso2bps-3.0.0.zip.
3. Extract the zip file to a folder which will be referred to as <CARBON_HOME> throughout the rest of this guide.
4. Open a command prompt (or a shell in Linux) and go to <CARBON_HOME>\bin directory.
5. Start the BPS server by executing wso2server.sh (or wso2server.bat in Windows).
6. The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."
Modelling a BPEL Process
1. Download and setup WSO2 Developer Studio. (http://wso2.com/products/developer-studio)
2. Open the Developer Studio and select File -> new -> Other.
3. From the dialog window, select "Carbon Application Project" and click Next.
4. Provide a suitable name to the Carbon application project. In this example, it is named as "WS_NumberAdderCarbon". Click "Finish" once done.
5. Carbon Application project will be created and you can see it on “Project Explore” window
6. Create a new BPEL project. Right click on the project which is on “Project Explore” window and choose New -> BPEL WorkFlow
7. On the “Create New BPEL Project” wizard, select "Create New BPEL workflow" and click Next to continue.
8. Provide suitable names, a namespace and select the matching template for your BPEL process and project.
In this example, we use "BPELNumberAdder" as the project name. Also provide a valid namespace as the process namespace. Since we are creating the synchronous business process, select the template “Synchronous BPEL Process”.
- Process Name : AdderProcess
- Namespace : http://NumberAdder.com
- Template : Synchronous BPEL Process
9. Click "Finish" to close the wizard.
Expand the "WS_NumberAdderCarbon" project folder in the "Project Explore" window to view another folder named "BPELNumberAdder". The "BPELNumberAdder" project is used here for BPEL process development. The “Project Explorer” window and the AdderProcess.bpel file will look like the following.
This point onwards you have to design your bpel process by adding business logic to the BPEL process. In this guide we will be designing a simple process to add two integers.
10. Open “AdderProcessArtifacts.wsdl” file in BPELNumberAdder Project in order to set input parameters. Click on the arrow next to "Adder Process Request".
It will open another tab called “Inline Schema of Add”. By default it will have a single variable named “input” with type string. Rename it as x and set the type to int.
11. You need to add another element. To add another element right-click on Adder Process Request Type and “add an element” after it. Name it "y" and set the "type" as "int". Now it should look like the follwing image.
12. Now lets design the simple business logic. Go to the AdderProcess.bpel file and. You need to add business logic in the place of where “FIX_ME-Add_Business_Logic_Here” activity resides. Delete the “FIX_ME-Add_Business_Logic_Here”. You will have the following process.
(Tip: to delete, right-click on the element and choose delete)
13. Now you need to add an Assign activity in between “receiveInput” and “callbackClient” activities. To add Assign activity drag it from the Action section of the Action Palette.
(Tip: another way to add activity element to the editor is right-click on element and use add-before option)
14. Now you need to configure Assign activity. Click on “Assign” element which is on bpel process and then click on “Details” tab in ”property window”.
Click on “New” which will lead you to the following view in “property window”
15. We will use an Xpath expression to compute the addition of two variables and assign the result to the output variable. To do that choose “Expression” from “From” drop down list and choose “Variable” from “To” drop down list.
17. Choose “Xpath 1.0 in BPEL 2.0 ” as Expression Language.
18. The Expression which we need to evaluate is “ $input.payload/tns:x + $input.payload/tns:y ”. Include this in the box below “Expression Language”.
19. Select “result:string” under “To” as the assigned variable.
20. While you configure the variables, The editor will ask to initialize the variables. Click yes. It will automatically generate an xml string for variable initialization.
The property window of Assign activity should look like the following once you have completed the steps.
21. Now you need to define inbound and out bound interfaces. Open deploy.xml file which is in the bpel project. Choose AdderProcessPort as the inbound address port from the given list. Rest of the parameters will be automatically filled once you select it.
There will not be any ports for out bound interfaces as we do not have external invocations in this business process.
22. Include the BPEL process as a dependency of the Carbon Application (WS_NumberAdderCarbon). To include it, open “pom.xml” of Carbon application project and select BPELNumberAdder as a dependency.
Deploying and Testing the BPEL Process
After modelling the BPEL process, it can be deployed in the WSO2 BPS.
1. In the Developer Studio, right-click on the "Servers" window. If it is not visible, select Window -> Show View -> Servers.
2. In the "Servers" window, select New -> Server.
3. The "New Server" window appears. From the List, expand the "WSO2" folder and select "WSO2 Carbon 4.0 based server" as shown below. Carbon 4.0 based server is selected here since BPS 3.0.0 is based on Carbon 4.0.2.
If needed, specify the Server name here. In this example, we specify it as WSO2 BPS. Click "Next"
4. Set the CARBON_HOME by clicking the "browse" button and selecting WSO2 Business process Server home folder. Click "Finish" once done or "Next" if more settings of the server need to be configured such as the 'service port', 'web console port' etc.
5. Once done, the WSO2 BPS will be added to Servers List as shown below.
6. The next step is to deploy the carbon application in WSO2 BPS. Simply click on "WS_NumberAdderCarbon" project in "Project Explore" window and drag and drop it on Server. The server will be automatically started.
If the server does not get started automatically, run the server by right-clicking on it and selecting "Start". In Console window, note the server process's log.
8. WSO2 BPS login page will be opened automatically in the default web browser. Login using admin as username and admin as password.
9. Select "processes →list" menu from the "Main" menu. The "Deployed Processes" window opens with the "AdderProcess" deployed.
Note the "Process ID" generated in the format {"Process NameSpace"} ProcessName-VersionNo. Click on the Process ID.
10. The "Process Information" window appears with the details of the process. Click on the "Try It" link.
11. A browser window opens to enter the required input parameters. Enter the values and click "Send" for the answer.
Note
Alternatively, you can use the SOAP UI tool to test a business process. The SOAP UI application shows the request/response soap messages and is particularly helpful in error handling.