This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Creating a BPEL Process
This tutorial guides you on how to create a BPEL process using the WSO2 EI tooling.
Before you begin,
- Install Oracle Java SE Development Kit (JDK) version 1.8.* and set the JAVA_HOME environment variable.
- Download the WSO2 EI ZIP file from here, and then extract the ZIP file.
The path to this folder will be referred to as<EI_HOME>
through out this tutorial. - Select and download the relevant EI tooling ZIP file based on your operating system from here and then extract the ZIP file.
The path to this folder will be referred to as<EI_TOOLING>
through out this tutorial.
This tutorial includes the following sections:
Creating the process
- In WSO2 EI Tooling, to create a business process, follow the steps below.
- Right-click on the Project Explorer and go to New -> Project.
- Clicking project opens the New Project window
- Click Next and client creates the BPEL project.
- Right-click on the Project Explorer and go to New -> Project.
- Generate a business process with the synchronous business process template. Use the following steps to accomplish this.
- Select a wizard from the subsequent screen that appears after creating the BPEL project.
- Select the New BPEL Process File and click Next.
- In the resulting screen, enter the BPEL Process Name, the Namespace and the Template as shown in the below image.
- Click Next.
- Create a WSDL file by filling out the Service Name, Port Name, Service Address and Binding Protocol as shown in the following image.
- Click Next and finish the process. The following screen appears.
- Select a wizard from the subsequent screen that appears after creating the BPEL project.
- Drag and drop Receive, Assign and Reply activities such that you get the following process.
- Click on the Assign activity and assign ‘input’ from the input variable to ‘result’ from the output variable.
- Similarly, complete the next Receive, Assign and Reply activity by using the same partner link ‘client’. Now you have completed the process logic. Next you need to add the correlation set to two Receive activities.
- Create a correlation set by clicking on the ‘+’ sign next to Correlation Sets.
- Select the correlation set and select Properties and click Add.
- You see the Select a Property wizard. Click New.
- Give a Name to our correlation property and select Simple Type under the Defined As section.
- Select the data type for our correlation property. In this instance, you have selected a ‘Simple Type’.
- Click Browse. Now we have to select the data type from XML schema types. Select string as our type.
- Click OK. Now a pop up box appears and asks for the prefix to be used to the XML schema namespace. Enter the prefix as ‘xsd’.
- Click on the New button next to Alias to define the property alias. The Create Property Alias window appears.
- Select Message Type from the available options.
- Click on Browse. Also select input string for query.
- Click OK and finish the process.
Now you have finished defining the correlation set, property and alias.
Note that you selected only one alias here because you are using the same message for both receive activities.
Now we have to add the correlation set to the receive activities. On the first Receive activity, which creates the process instance, initialize the correlation set. On the next, Receive activity; it is not necessary to initialize the correlation set. Click on the Receive activity, and go to Properties, click Add and select the correlation set. Since there is only one correlation set, it is the only one that appears. On the Initiation section select Yes.
- On the next correlation activity, set Initiation to No.
- Next, generate the deployment descriptor.
- Next select all files related to the project and create a ZIP package.
Deploying the process using EI-Business Process runtime
- Start the EI-Business Process runtime by going to
<EI_HOME>/wso2/business-process/bin
and using the command line terminal and executing one of the following commands:- On Linux/Mac OS:
sh wso2server.sh
On Windows:
wso2server.bat --run
- On Linux/Mac OS:
- In a new browser window or tab, open https://localhost:9445/carbon/ and log into the EI-Business Process management console using
admin
for both the username and password - In the management console, navigate to Home -> Manage -> Processes ->Add -> BPEL and upload the BPEL package.
Once the process is deployed successfully, you can use tryit to send a request to the process. - Now navigate to the instance view for this process. The instance has completed up to the Reply activity and is waiting on the next Receive activity. Under the correlation properties, you can see the value sent in the request.
- Now send the same request from tryit again. The process instance has gone to the completed state. You can follow the same steps used here to add correlation sets to any asynchronous business process you implement. Correlation sets can be added to ‘receive’, ‘invoke’ and ‘pick’ activities.