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 Carbon Composite Application Project and click Next.
  4. Provide a suitable name to for the Carbon application project. For the purposes of this example, name it as "WS_NumberAdderCarbon". Click Finish once done.
    The Carbon Composite application project is created and you can see it on Project ExploreExplorer pane on the left of your Developer Studio screen.
  5. Create a new BPEL project. To do this, right-click on the project which is on the Project ExploreExplorer 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 ProjectWorkFlow” 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. 
  8. 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”.
  9. Click Finish to close the wizard.
  10. Expand the "WS_NumberAdderCarbon" project folder in the "Project ExploreExplorer" pane 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.
  11. 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”AdderProcessArtifacts.wsdl
  12. . By default it will have a single variable named “input” with type string. Rename it as x and set the type to int.
  13. You need to add another element. To add another element right-click on "AdderProcessRequestType" and “add an element” after it. Name it "y" and set the "type" as "int". Now it should look like the follwing image.
  14. Now lets design the simple business logic. Open the AdderProcess.bpel file. 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” element. You will have the following process.

    Info

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

  15. 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.

    Info

    Another way to add activity element to the editor is right-click on element and use add-before option.

  16. 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”. 
  17. Click on “New” which will lead you to the following view in “property window”
    Image RemovedImage Added
  18. 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.Choose “Xpath 1.0 in BPEL 2.0 ” as Expression Language.
  19. The Expression which we need to evaluate is “ $input.payload/tns:x + $input.payload/tns:y ”. Include this in the box below “Expression Language”.Select “result:string” under “To” as the assigned variable"Edit the associated Xpath Expression".
  20. While you configure the variables, The editor will send you a message asking you 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.
    Image RemovedImage Added
  21. 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 from the given list. The rest of the parameters will be automatically filled once you select it. There will not be any ports for outbound interfaces as we do not have external invocations in this business process.
    Image RemovedImage Added
  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. 
    Image RemovedImage Added

Deploying and testing the BPEL process

...

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.