Friday, September 4, 2009

Creation of a Simple BPEL Process - Hello

We shall create a very simple BPEL process. The intent is to learn the following
  1. Overview of this exercise
  2. BPEL Designer in JDeveloper
  3. Partner Link
  4. Process Activities - Receive, Invoke, Assign
  5. Data Transformation
  6. Compilation
  7. Deployment
  8. Accessing Enterprise Manager
  9. Creation of Test Suite
Overview
We will create a very simple BPEL process. The process does not orchestrate any services. It just takes an input from the client and transforms it and sends it back as a response.
Example
Input = "Hello"
Output = "Hello CrystalTrain"

Creation of BPEL Process
This involves the following steps
  1. Creation of Application
  2. Creation of Project
  3. Data Transformation
  4. Compilation, Deployment and Testing 
This prompts you to create a BPEL Process

The default process comprises of the following
Below is the design view of the process
Let us take a look at the Receive BPEL Activity. It receives the request from the client and holds the payload of the request in the inputVariable.
Let us take a look at the Reply BPEL Activity. It sends a response back to the client with the data stored in outputVariable.
Our intent is to modify the message received from the client. This is stored in inputVariable.
This can be done in Assign BPEL Activity as can be seen below.
Drag the Assign BPEL Activity that is avalable in the ComponentPalette>BPEL Activities and Components
Drag and Drop the Assign BPEL Activity in the highlighted circle in between Receive and Reply Activities
Now edit the Assign Operation.
In General Tab, Rename it to "TransformMessage"
In Copy tab, 
You will see "Create Insert-After Operation" window
In the left hand side pane, select "Expression" as the Type
Now using "XPath Expression Builder", modify the inputVariable as seen below.
Assign the transformed value to the outputVariable
Build and Deploy
Save the project.
Right click on the project and make "HelloWorld.jpr". This will compile the project and output any errors to the log window.
Now right click on the project and select Deploy>HelloWorld>to Crystal
Note : Your ApplicationServer connection in the IDE should be up.
Accept the default values in "SOA Deployment Configuration Dialog".
Enter the domain credentials when asked.
Check the Deployment log to see that the status of the deployment.
Testing the BPEL Process
Go to EnterpriseManager at http://localhost:7001/
After entering your credentials you will be taken to the Home page (The login takes a looooong time)
To the left side, you will see
Click on the "Test" button
Enter the Input now

The response looks as follows


As show above, click on "Launch Message Flow Trace" to see the Audt Trail, Flow, XML from the request till the response.

Click on "Simple Process" to view the Flow Trace.

See below for the Audit Trail of this instance of the process.


Select the "Flow" tab to see the flow of request throgh the process actvities

Now, since you have successfully created your first BPEL process, start playing with the BPEL Designer and the EnterpriseManager. Make as many mistakes as possible and try to figure out the resolution for each. Be BOLD and try out the following. The more mistakes you make now the less you will make in future. 
  1. In the BPEL Designer in JDeveloper, view the Source of the .bpel file and see if you can make any sense of it.
  2. Remve the expression from the Assign activity and try to build the project. See the compilation errors.
  3. Open the logs at C:\oraclesoa\user_projects\domains\crystal_domain\servers\soa_server1\logs to familiarise yourselves.
  4. Go to the Design mode and edit the Assign process activity and change the expression value. Save the changes and deploy it. Follow the steps shown in the figure below. 

1 comment: