Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Download and setup WSO2 Developer Studio.
  2. Open the Developer Studio and select File > New > Other.
  3. From the window that appears, select Composite Application Project and click Next.
  4. Provide a suitable name for the project. For the purposes purpose of this example, name it as "WS_NumberAdderCarbon". Click Finish once done.
    The Composite composite application project is created and you can see it on Project Explorer pane on the left of your Developer Studio screen.
  5. Create a new BPEL project. To do this, rightRight-click on the project which is on the Project Explorer pane and choose New > BPEL WorkFlow. If it does not appear there, click Other and search for BPEL WorkFlow on the search bar. 
  6. On the Create New BPEL WorkFlow” wizard wizard, select Create New BPEL workflow and click Next to continue.
  7. Provide suitable names, a namespace and select the matching template for your BPEL process and project. More information on the different templates can be found here
    In For 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”.the following values can be used: 
    • Project Name : BPELNumberAdder
    • Process Name : AdderProcess
    • Namespace : http://NumberAdder.com
    • Template : Synchronous BPEL Process
    Image RemovedImage Added
  8. Click Finish to close the wizard.

    Expand the "WS_NumberAdderCarbon" project folder in the "Project Explorer" pane to view another folder named "BPELNumberAdder". The "BPELNumberAdder" project is used here for BPEL process development. The “Project Explorer”

    The Project Explorer window and the AdderProcess.bpel file will look like the following.
    Image Added

    Image Removed
    Note

    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.

  9. Open “AdderProcessArtifactsAdderProcessArtifacts.wsdl” wsdl file in BPELNumberAdder Project in order to set input parameters. Click and click on the blue arrow next to "Adder Process Request".
    Image Removed
    It  It will open another tab called “Inline Schema of AdderProcessArtifactsInlineSchemaofAdderProcessArtifacts.wsdl”. By default it will have a single variable named “input” with type string. Rename it .
    Image Added


  10. Rename the default variable named as "input" as x and set change the type from "string" to int. 
  11. You need to add Add another element . To add another element by right-click on "AdderProcessRequestType" and “add an element” after itclicking on AdderProcessRequestType>Add an element. 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. Open the AdderProcess.bpel bpel file. You need to add business logic in the place of where “FIXFIX_ME-Add_Business_Logic_Here” Here activity resides. Delete the “FIXFIX_ME-Add_Business_Logic_Here” Here element. You will have the following process.

    Info

    To delete, right-click on the element and choose delete.

  13. Now you need to add Add an Assign activity in between “receiveInput” receiveInput and “callbackClient” callbackClient activities. To add Assign activity drag it from the Action section of the Action Palette.

    Info

    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 the Assign element and then click on “Details” Details tab in ”property window”the Properties window
  15. Click on “New” which New which will lead you to the following view in “property window”the Properties window.
  16. 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” select Expression from the From drop down list and choose “Variable” from “To” select Variable from the To drop down list.
  17. The Expression which we need to evaluate is “

    Include the following expression in the box below "Edit the associated Xpath Expression".

    Code Block
    $input.payload/tns:x + $input.payload/tns:y
    ”. Include this in the box below "Edit the associated Xpath Expression".
     
  18. While you configure the variables, The editor will send you the a message will appear asking you to initialize the variables. Click Yes. It will automatically generate an XML string for variable initialization. The property Properties window of Assign activity should look like the following once you have completed the steps.
  19. Now you need to define inbound and out bound interfaces. Open the deploy.xml file which is in the BPEL project. Choose AdderProcessPort as the inbound address port Inbound Address Port from the given list. The rest of the parameters will be automatically filled in once you select it. There will not be any ports for  You do not need to specify ports outbound interfaces as we do not have external invocations in this particular business process.
  20. Include the BPEL process as a dependency of the Carbon Application Composite Application (WS_NumberAdderCarbon). To include it, open “pompom.xml” xml of Carbon Composite application project and select the BPELNumberAdder checkbox as a dependency. 

Deploying and testing the BPEL process

...

  1. In Developer Studio, right-click on the "Servers" Servers window and select New -> ServerNew>Server. If it is not visible, select Window -> Show View -> ServersWindow>Show View>Servers.
  2. The New Server window appears. From the list, expand the WSO2 folder and select WSO2 Carbon 4.4 based server as shown below. Carbon 4.4 based server is selected here since BPS 3.5.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.
    Image RemovedImage Added
  3. Set the CARBON_HOME by clicking the Browse button and selecting WSO2 Business Process Server home folder_Home directory. 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.
    Image RemovedImage Added
  4. Once done, WSO2 BPS is added to Servers List as shown below.
    Image RemovedImage Added
  5. The next step is to deploy the carbon composite application in WSO2 BPS. Go to WSO2 BPS Server>Add and Remove and select the WS_NumberAdderCarbon project.  The server will be automatically started.
  6. If the server does not get started automatically, run the server by right-clicking click on it the server and selecting select Start. In Console the console window, note the server process's log. 
  7. The WSO2 BPS login page will be opened open automatically in the default web browser. Login using admin as username and admin as password.
  8. Select Processes >BPEL>List" menu from  from the Main menu. The "Deployed Processes" window opens with the "AdderProcess" deployed.

    Info

    The "Process ID" is generated in the format {"Process NameSpace"} ProcessName-VersionNo.

    Image Added

  9. Click the Process ID.

    Image Removed

  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.press Send to calculate the result. 
Info

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.