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. 

No comments:

Post a Comment