Saturday, September 19, 2009

Creation of a Synchronous BPEL Process

This will cover the concepts, design, testing and deployment of Synchronous BPEL Process.

What this blog helps to understand
  • Using WebService PartnerLink
  • Using Invoke BPEL Activtiy
  • Using the webservice.
  • How to create a Synchronized BPEL Process
Note:
  • We will utilize the webservice that was created earlier. This will help in understanding how the webservice that you created before is being orchestrated by the BPEL Process.
  • We shall not do the data transformation between different data types. Fortunately, int to string and string to double conversion seems to be done out of the box.
 Intent
  1. To create a Synchronous BPEL Process that takes a FICO score(input) and determines the APR(output). Let us call this a MortgageProcess.   
Prerequisite
Concepts of Synchronous Service
  • This article explains the Synchronous and Asynchronous webservices
  • The difference between Synchronous and Asynchronous BPEL Process is excellently defined here and I shall not duplicate this below.
Design
  • Choose "New Project ..."
  • In the "New Gallery" window, select "SOA Project"
  • In the "Create SOA Project Step1 of 2", enter Project Name as "SynchronousMortgage"
  • In the "Create SOA Project Step2 of 2", select the Composite Template "Composite with BPEL" and click on "Finish" button.
  • This will launch the "Create BPEL Process" window as seen below


  • After creation, the default design view of the MortgageProcess looks like below


  • Now, invoke the CreditService webservice. You can do this by dragging and dropping the "Partner Link (WebService/Adapter)" from the "BPEL Sevices" section in the Resource Palette(as shown below) to the Partner Links swim lane on the right side. 


  • Once it is dropped, the "Create Partner Link" dialog appears where the partner link needs to be configured to invoke the CreditService.



  • Now, there should be a BPEL Activity to invoke the WebService through the Partner Link we configured in the previous step. For that, drag the "Invoke" BPEL Activity from Component Palette>BPEL Activities and Components and drop it into the middle lane and configure it as shown below.


  • Connect the InvokeActivity with the "SyncCreditProcess" PartnerLink  and configure it as shown below.




  • Now, assign the "Invoke_CreditProcess_process_InputVariable" with the input received from the client which is the FICO score. When the process runs, the web service operation is invoked and this input value is passed to it.


 


  • Double click on the Assign Activity

  • In "General" tab, change the name to a meaningful one like "Assign_FICO"
  • Go to "Copy Operation" tab
  • Click on green + arrow to select the "Copy Operation..."

  • In the "Create Copy Operation" screen do the following




  • When the process runs, the web service operation returns the response instantaneously(synchronized). Since this value has to be returned to the client, assign "Invoke_CreditProcess_process_OutputVariable" to the response (output which is the APR)

  • Drag and drop the Assign Activity in between Receive and Reply activities as seen below


  •  Double click on the Assign Activity
  • In "General" tab, change the name to a meaningful one like "Assign_APR"
  • Go to "Copy Operation" tab
  • Click on green + arrow to select the "Copy Operation..."
  • In the "Create Copy Operation" screen do the following


 Deployment
  1. Now save the .bpel file
  2. Make the project
  3. See the compiler log. You will see warning messages on assigning incompatible types. This is true since the FICO score should be integer and APR is returned as double. Since we wanted to focus only on the creation of synchronous process we shall ignore such wrong programming practice for this example.
  4. Deploy to Crystal Domain
  5. Check the Deployment log to see if the dployment is successull.
Testing
  • Go to Oracle Enterprise Manager 
  • Under SOA>soa infro, you can see SynchronousMortgage deployed.
  • On the right side, clck on Test button
  • Enter the InputValue 500 and the system outputs 20.
Note
  •  Note that it is the type of response(immediate or callback) that decides if the BPEL Process is Synchronous or Asynchronous.
  • Each domain has the attribute syncMaxWaitTime that by default is set to 60 seconds and can be reconfigured by the doman administrator. The Invoke Activity cannot wait for more than this time and will time out.
Real World Scenarios
  • A Credit Card Authorization during an online purchase is good case for a Synchronous Process as an authorizaton response is expected by the CardHolder immediately. 

Thursday, September 10, 2009

Oracle SOA Suite 11g Reference Documentation

Here are some of the useful links I found on the Oracle SOA 11g.  I shall keep updating them. Please drop a comment if you know of any.

Oracle Developers Guide for SOA Suite 
http://download.oracle.com/docs/cd/E14571_01/integration.1111/e10224.pdf

Oracle BPEL Documentation 


Oracle Business Rules Documentation


BPEL Blogs
http://orasoa.blogspot.com/2007/05/getting-started-with-oracle-soa-bpel.html

http://dietrichschroff.blogspot.com/search/label/BPEL


Oracle SOA 11g Memory Requirements

For folks interested in installing Oracle SOA Suite 11g, please read this to check if your desktop/laptop is suitable.

I installed the Oracle SOA Suite 11g on my new laptop which has Windows Vista on a 4GB RAM. I profiled the memory hike on the start of each service. Here it is
  • When windows started up(only basic services)  with OracleXE as Service: 39%
  • Started Oracle JDeveloper 11g : 47%
  • Started Oracle Weblogic Console : 66%
  • Started Node Manager : 69%
  • Started SOA Serve : 87%
If you plan to open a Office software or run other SOA Services like BAM then this machine crawls. You may want to plan for at least 6GB RAM. If not, you will end up watching the TaskManager every minutes to see f you can kill any process .

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.