Pages

Sunday, July 8, 2012

CRUD operations with the Entity variable – Oracle SOA Suite

CRUD operations with the Entity variable in Oracle SOA Suite:

In Oracle SOA Suite, we can use the Entity variables to perform the CRUD operations on the database. Entity variable will have the reference to the SDO enabled web services like ADF BC web service.
In Oracle SOA Suite we can expose the View objects (VOs) in ADF BC as SDO’s. SDOs enable you to modify business data regardless of how it is physically accessed.

For each Entity variable, a Unique Key (e.g. Primary key) must be associated with the corresponding Element.

Entity Variables automatically propagate data object changes through the ADF BC layer via "Change Summary" operations and can be used in BPEL by means of a partner link of either an ADF-BC binding or SOAP (WS) binding reference to your ADF BC service.

We can use the following activities Create Entity, Bind Entity and Remove Entity to perform the CRUD operations.

Bind Entity:

This activity enables you to select the entity variable to act as the data handle. This action select the row from the datasource, the update/Delete operation can be performed on the selected data.  

Create Entity: 

This activity enables you to create an entity variable. This action creates a row in the Datasource. 

Remove Entity: 

This activity enables you to remove an entity variable. This action removes the row from the datasource.

Follow the previous blog (Invoking a ADF-BC service from the SOA Composite – Oracle SOA 11g) to create and deploy the ADF BC SDO service.

Create a BPEL process which will take the employee details as input/output as shown below.


Create the web service parnerlink in the composite.xml by consuming the ADF BC service URL created in the previous blog. 




Design the BPEL process to perform the CRUD operation on the database:

  • Create the entity variable
  • Create new variable inputToEmpAppService as an Entity variable
  • Select the Type as Element and select employeeViewSDO element as the type

  • Select the Entity Variable checkbox
  • Select the parnerlink as the EmpAppService (created in the above step)
 
  • Create the variable employeeInput by following the above steps but don’t select the Entity variable check box

  Design the BPEL process as shown below:

  • Create the Switch activity and perform the below activities based on the operation name passed to the BPEL as input (DeleteEMP, SelectEMP, UpdateEMP and CreateEMP)
  • Select Employee – Select the employee based on the primary key (Emp No) from the datasource.
  • Bind Entity – Bind the primary key of the Employee
    • Drag and drop the Bind Entity activity and select the entity variable created in the above step (inputToEmpAppService)
    • Select the key local part as the Emp No (from the Entity variable)and the Key value as the Emp No from the input variable


 
  • Assign the outputAdd the assign activity and assign the selected data from the entity variable (inputToEmpAppService) to the output variable.


Update Employee – Update the employee data based on the primary key

  • Perform the steps corresponds to Bind Entity from select Employee.
  •  Assign all the input variable data that needs to be updated to the Entity variable

Delete Employee – Delete the employee based on the primary key

  • Perform the steps corresponds to Bind Entity from select Employee.
  • Drag and drop Remove Entity activity and select the entity variable

 Create Employee – Create the employee in the datasource

  • Drag and drop an assign activity and assign the input employee details to the variable employeeInput.
  •   Drag and drop a Create Entity; select Entity variable and select the From as employeeInput variable.
 
  • Deploy the composite to the server.

Testing the Process from the SOAP UI:

  • Create Employee: 

  • Update Employee



  • Select Employee

  • Delete Employee

DOWNLOAD BindEntity.zip






2 comments:

  1. Hello,

    Thank you for this knowledge sharing.

    In BPEL 1.1 we have Entity variable facility available, as well as binding for ADF-BC binding service. But, I am not finding anything like this in BPEL 2.0 . I have searched at many locations, but couldn't able to find answers. There are neither binding facility nor Entity Variable facilities available in the BPEL 2.0. Please suggest an alternative way to perform this.

    Thank you in advance.

    ReplyDelete
  2. Hi Albin,

    Can you respond to Maulik's comment above. I am also looking for the same in 11.1.1.7

    Thanks,
    Sai

    ReplyDelete