Thursday, August 13, 2009

CRUD operations with a Bind Entity variable in BPEL

With Soa Suite 11G ( FMW 11G R1) you can now use the Bind Entity activity in a BPEL process, which can do your CRUD operations for you. This Bind Entity is connected to a web service reference, this WS has to have SDO types just like an ADF BC SDO service interface. Now you can use an normal Assign activity to retrieve or update data from the Entity variable instead of an invoking a lot of Partner Links.


First we need to make a SDO web service. For more details then this short description, see my previous blog or this blog of Andrejus .

I made an simple ADF BC Model project with an Employee viewobject based on the employees table in the HR sample schema.

Create a Service Interface on this Employees Viewobject and select all the basic operations.

JDeveloper 11G generates SDO types on this employees viewobject and generates a Web Service on this Application Module. We will use this WS in the BPEL process.

Create a new Service Interface deployment profile

Deploy this to a Weblogic Server


The Web Service is ready and we can create a new SOA Project. I use a XSD with a simple request and response. The input will be the EmployeeId and the BPEL process returns the lastname

We don't need use the ADF-BC service adapter, just add the Web Service Adapter to the Composite. Use the WSDL of the Employee WS in the WS Reference adapter


Wire the WS adapter reference to the BPEL process
Open the BPEL process and add a new variable


Select the partnerlink in the entity variable.

Select the Employee WS
Now we need to define the element in this variable. Select the Employees SDO element


Add the Bind Entity activity to the BPEL process, This will map the Primary Key on the just created variable.

Select the just created employee variable
Select the Primary Key Element of the Employee XSD. In my case is this EmployeeId

And use the BPEL request (input) variable as value to this PK column. This will lookup the right employee

We are ready with the configuration of the Bind Entity. We can now use Assign Activities to retrieve or update the Employee record. In my case I will get the lastname of the employee and return this as response

that's all , just deploy this to the Soa Server and test this in the EM website. Use for example 199

This returns Grant as lastname

Here you can download the test workspace

2 comments:

Technical Analysis in Indian stock market said...

How can a EJB service used in BPEL?
i.e: I have exposed one ejb as service(thru webservice), and this ejb method returns List of specific type data object.
In BPEL I am not able to retrieve this return type, mainly because SOA server complaints cast exception, cannot convert vector to sdo object.
Do you have any example of such ejb service where method returns List or collections and used in BPEL thru variables.

Edwin Biemond said...

Hi,

What for soa suite are you using, did you try my ejb soa suite 11g example

thanks Edwin