Saturday, July 7, 2012

Oracle SOA Suite Part 1 Hello BPEL

In this N part series, I am going to blog about each and every piece of Oracle SOA suite. Today, I am going to start with Hello BPEL.

Requirements

I assume that you have some knowledge on BPEL and SOAP based web services. I assume that you have installed oracle SOA suite 11g along Jdeveloper and required plugins. I am using the 11.1.1.6 version pre built VM from oracle site. If you have enough resources like >8 GB RAM, 50-70 extra Hard drive space and good internet speed then I would encourage you to download the pre-built VM as it would not affect your computer performance.

Overview

In this demo, we are going to create a BPEL process and pass a String as input to BPEL process and in return we get “Hello “+String (from input) as output.

Hello Word Project

1. Let us fire up Jdeveloper and create a new Application.

2. Enter the Application Name as HelloBPEL

3. Choose Application Template as SOA Application and click Next button

clip_image001

4. Enter the project name as HelloBPEL and click Next

clip_image002

5. For now let us have the defaults and click Finish

clip_image003

6. You should see a composite.xml file opened in your editor. Note: if you did not install SOA plugin you would just see the xml file not the composite editor. Make sure you have installed the SOA plugin

clip_image005

7. Let us understand few details about composite editor. Composite editor gives a high level view of what is happening in your project. It is divided into three columns

a. Components: Components column display all the components such as BPEL, Mediator, Human Task etc. being used in the project. It also displays how these components are interconnected.

b. Exposed Services: Exposed Services lists out all the front ends for your application using which external applications/code can interact with this SOA application.

c. External References: External References lists out all the services that are being used by your application.

8. If you don’t see a Component Palette window, then click on View > Component Palette

clip_image006

9. Drag “BPEL Process” from Component Palette window on to Components column of the Composite editor. Notice that during drag when you place your mouse on references or services column then mouse pointer turns as wrong arrow indicating that you cannot drop BPEL Process onto those columns. When you place it on components column during drag it show a little plus symbol

10. You should see a “Create BPEL Process” window after you have dropped BPEL Process icon. Please perform following actions

a. Use BPEL 2.0 Specification

b. Enter the project name as “HelloBPEL”

c. Switch Template to Synchronous BPEL Process and leave the defaults

d. In order to invoke this BPEL process, you need a service end point so you should have check box “Expose as a SOAP Service” checked.

e. Since this BPEL process is going to take String as input and return String as output, we are ok with default values in input and output. In later blogs, I will show you how you can customize these parameters

f. Please verify your values with the image below and click OK

clip_image007

11. You should see the following in the composite editor

clip_image008

12. Now double click on the HelloBPEL block in the composite editor and it opens a new editor called BPEL Editor. You should see the following (if you don’t see it then you did not install SOA plugin for Jdeveloper)

clip_image010

13. We can clearly depict that as client invokes BPEL process by supplying the input, which is received using receiveInput activity and replyOutput returns the output back to the client.

14. You should also see a panel named “HelloBPEL – Structure” on the lower left of the jDeveloper, expand the Variables > inputVariable > payload > client:process > client:input and observe that input is String. Similarly, confirm that outputVariable is also String type

clip_image011

15. Now we need to assign “Hello[SPACE]input” to the output so, drag assign activity present under BPEL Constructs section of the Component Palette and drop it on the line connecting receiveInput and replyOutput. See the image below

Note: As you try to drag on to the line, you should see a Green Plus symbols indicating the potential places where you can drop Assign activity

clip_image012

16. Notice that in the BPEL-Log window, you should see the following warning message. This is because every assign statement should have at least one assignment

clip_image014

17. Now Let us finish the assignment, double click on Assign1 activity and it should open Edit Assign window

clip_image016

18. On the Copy Rules tab, expand the outputVariable on the right hand side up to the leaf node i.e., client:result. Drag the expression buttonclip_image017 (located on top) to the client:result. You should see following window after you have dropped the expression icon. In the Functions section, change the drop down to “String Functions” and find concat function and double click on it. You should see that concat() is auto typed in the Expression section.Put your cursor with in the paranthesis of concat() and type “‘Hello ‘,” (include single quote, space and comma. From BPEL Variables section, expand inputVariable > payload > client:process >client:input and double click on it. You should see following as expression


concat('Hello ', $inputVariable.payload/client:input)


clip_image019

19. Click OK button to close Expression Builder. Click OK to close Edit Assign window

20. You should see that BPEL Log mentioned in step 16 will not have any errors and warnings

21. We can do an additional check to see if you BPEL is has problem by clicking on validate button (clip_image020) present at the top of the BPEL editor

clip_image021

22. Save the project and you are done with coding aspect of BPEL

Deployment:

You need to add Weblogic server to Jdeveloper before, you can deploy this application. A quick search on “how to add Weblogic server to Jdeveloper” would give you the details.

1. Make sure that your Weblogic and SOA server are up and running.

2. Now Right click on the project in Jdeveloper, and select deploy > HelloBPEL…

clip_image022

3. You should see following window

clip_image023

4. Select Deploy to Application Server and hit Next > button. Have the defaults on the next screen and click Next > button

clip_image024

5. Now select the server ( devsoa in my case) and hit Next > button

clip_image025

6. After a brief period of time, you should see this window (see below). If you have more than one server listed then select the server on which have installed SOA Suite and click Next > button

clip_image027

7. You should see the following window and hit Finish button.

clip_image029

8. In the deployment log window, you should see a line as deployment finished

clip_image031

9. This confirms that your deployment is complete.

Test:

In this blog post, I would show the simplest way to test BPEL process. In subsequent blog posts, I would show you various other ways to test BPEL Process.

1. Login to your enterprise manager. It should be located at http://servername:7001/em (in my case it servername is localhost). The default username/password should be weblogic/welcome1 unless you have changed it.

2. From your Farm folder present on the left, expand SOA > soa-infra > default and observer that HelloBPEL[1.0] version is present. Note: you path might be different depending on your installation. Click on the HelloBPEL[1.0]

clip_image032

3. You should see that the main window present on the right side changes to something like below. Click on the Test tab

clip_image034

4. You should see following window. In the input Arguments section, specify some name (For e.g., Srikalyan :)) and click Test Web Service button

clip_image036

5. You should see the Response result as Hello inputName.

clip_image038

6. That’s it. You are done creating, deploying and testing your first BPEL process.

Note: You can download the code from https://bitbucket.org/srikalyans/bpelexamples/downloads

Please drop a comment if you face a problem.

No comments: