Wednesday, April 10, 2013

Hello World BPEL Process

Hi Guys,

Hope you liked my previous article.Today We are going to see,how to implement Hello World in BPEL Process.It is a basic tutorial for all those willing to learn SOA.Without any more words, lets start with the tutorial.Let me just give you a brief overview of BPEL process.We will create one synchronus BPEL process that will accept string as an input and will return the same string in output concatenated with "Hello".So lets start desigining our BPEL process step by step.

Prerequisite for this tutorial

1. Oracle JDeveloper
2. Oracle SOA Suite
3. Weblogic Server

I have done this tutorial using Oracle Soa Suite , JDeveloper and Weblogic Server If you guys have not installed above mentioned softwares,you can get it from Here:

1. First of all go to Files --> New. Then navigate to Applications under categories on left hand side and select Generic Application.Click OK.


2. Window will pop up and prompt you for Application Name.Give the application name as SOALabs and click next.

3. Next window will ask you for project name.Give the project name as HelloWorld and under project technologies tab select SOA and click next.

4.Select "Composite with BPEL Process" as composite template and finish.

5.Now soon after clicking finish, new window will pop up for creating BPEL process.Change the name of BPEL process to "HelloWorldProcess" and select template as "Synchronus BPEL Process".Leave rest of the settings as default.All these configurations will be explained in coming tutorials.Click OK.

6. BPEL process will be created and composite will look as follows:

7.Double click on HelloWorld BPEL Process and the BPEL process editor will open up.Here you can see two activities already there "receiveInput" and "callbackClient". "receiveInput" is a receive activity and is used to receive the input from the client and store it in an input variable. "callbackClient" is an invoke activity that will return the output back to the client through helloworldprocess partner link.

8. Now from component pallette drag and drop one assign activity between receive and invoke activity.This activity provides a method for data manipulation, such as copying the contents of one variable to another. Copy operations enable you to transfer information between variables, expressions, endpoints, and other elements.

9. Double click the assign activity and drill down to outputVariable/payload/processResponse/result in right hand side. We will be setting the ouput here that would be returned back to the client.Right click on result and click Expression.

10. Drag and drop concat function in the expression field and modify it as

concat('Hello ',bpws:getVariableData('inputVariable','payload','/client:process/client:input'))

What we are doing is we are concatinating Hello with the string that will be passed in input and returning back the concatenated result.Click OK and again in next window that appears.

11. Our BPEL process will look like this now.We are done with the designing part.Now its time to test the composite that we have created.

12. Right click on our project and select Deploy --> HelloWorld.

13. Deployment window will pop up.Select "Deploy to Application Server" and click next. (Deploy to SAR is used when you just want to compile your project and creates its SAR file).

14.Deployment configuration window will come up.Leave the setting as default and click next.


15. In the next window choose the application server you wish to deploy your composite on. If you havenot created your application server yet or dont know how to create app server connection GO HERE 

16. Select the partition on which we want our application to be deployed.Select default in our case.

17.Click finish on next window.

18. Verify composite has been successfully deployed by checkin deployment log.

19.Open up your Enterprise Manager(EM) and log in.After loggin in drill down to default partition and click on your composite "HelloWorld". To open up em use this url http://localhost:port/em (if deployed on local machine).

20. Click on test.Page will open up for entering the inputs.Enter any string in text box just below value field and click Test Web Service.

21. You will see the concatenated output in response tab as "Hello Karan Mann". To see the step by step execution of our composite click on launch flow trace.After that click on our BPEL process and examine the payload value under various activities.

Congratulations !!!. We have created ,deployed and tested our Hello World BPEL process. I tried to cover each and every minute detail that I could so that it can be really easy for anyone to understand and implement it. Hopefully you guys will like it and feel free to ask any queries or doubts if you have any. In forthcoming tutorials ,I will be explaining how to design and use basic JCA adapters with BPEL.Stay tuned in.