Versions Compared

Key

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

1. Download and setup WSO2 Developer Studio. (http://wso2.com/products/developer-studio)

2. Open the Developer Studio and select File -> new New -> Other.

3. From On the dialog windowbox that appears, select "Carbon Composite Application Project" and  and click Next.

Image RemovedImage Added

4. Provide a suitable name to the Carbon application project. In this example, it is named as "WS_NumberAdderCarbon". Click "Finish" once donefor the Composite Application Project. Click Finish.

5. Carbon Application project will be created and you can see it on “Project Explore” window A Composite Application Project is created and appears on the Project Explorer.

6. Create a new BPEL project. Right-click on the project which is on “Project Explore” window in the Project Explorer and choose New -> BPEL WorkFlow.

7. On the “Create Create New BPEL Project” wizardProject wizard, select "Create New BPEL workflow" and  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 Synchronous BPEL Process template “Synchronous BPEL Process”.

 

9. Click "Finish" to close the wizard.

Expand the "WS_NumberAdderCarbon" project folder in the " Project Explore" window Explorer to view another folder named "BPELNumberAdder". The "BPELNumberAdder" project  project is used here for BPEL process development. The “Project Explorer” window and the AdderProcess.bpel file will look like the following. 

This From 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 “AdderProcessArtifactsthe AdderProcessArtifacts.wsdl” wsdl file in the BPELNumberAdder Project 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”Another tab, Inline Schema of Add, appears. 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 "AdderProcessRequestType" and “add add an element” 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. Open the AdderProcess.bpel file. You need to add business logic in the place of where “FIXto where the FIX_ME-Add_Business_Logic_Here” Here activity resides. Delete the “FIXFIX_ME-Add_Business_Logic_Here” Here element. You will have the following process.

(Tip: to delete, right-click on the element and choose delete Delete) 

 

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

(Tip: another way to add an activity element to the editor is by right-click clicking on the element and use using the add-before option) 

14. Now you need to configure the Assign activity. Click on “Assign” element the Assign element which is on the BPEL process and then click on “Details” tab in ”property window”the Details tab in the Properties section.

Click on “New” which 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 , choose Expression in the From drop down list and choose “Variable” from “To” drop Variable in the To drop down list.

17. Choose “Xpath 1.0 in BPEL 2.0 ” as Expression Language.

1816. The Expression which we need to evaluate is $input.payload/tns:x + $input.payload/tns:y . Include this in the box below “Expression Language” Expression Language.

19. Select “result:string” under “To” as the assigned variable.

 

2017. Collapse the Output variable in the To section, and select result:string.

18. While you configure the variables, The the editor will ask to initialize the variables. Click yes Yes. It will automatically generate an xml string for variable initialization.

The property Properties window of the Assign activity should look like the following will be as follows once you have completed the steps.

Image RemovedImage Added

 

2119. Now you need to define inbound and out bound outbound interfaces. Open the deploy.xml file which is in the BPEL project. Choose AdderProcessPort as the inbound address port from the given list. Rest The rest of the parameters will be automatically filled once you select it.

There will not be any no ports for out bound outbound interfaces as we do not have external invocations in this business process.

2220. Include the BPEL process as a dependency of the Carbon Application (WS_NumberAdderCarbon). To include it, open “pomthe pom.xml” of Carbon application project xml of the Composite Application Project and select BPELNumberAdder as a dependency. 

...