Pages

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

7 comments:

  1. 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.

    ReplyDelete
  2. Hi,

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

    thanks Edwin

    ReplyDelete
  3. In 11G BPEL is there a way to get a distinct data set after a query comes back from a database adapter?

    The query we need to pull a full data set that goes into a collection. Then we need to make that dataset distinct by a field. Basically like a Oracle database distinct.

    Any ideas would be hugely appreciated!

    ReplyDelete
  4. Hello Mr. Biemond,

    I can't choose Bind Entity activity from the components palette. Though I'm on SOA Suite 11g, using jDev 11.1.1.6.0 and my BPEL process actually is of version 2.0. Global var has been defined as well. Any idea what I could verify?

    Thx in advance,
    KM


    ReplyDelete
    Replies
    1. Hi,

      Strang and does it work in bpel 1.1 plus can you create a new variable and choose bind entity.

      Thanks

      Delete
  5. What is best way DB Adapter Or ADF-BC SDO Web services, which one is better and why?

    ReplyDelete
    Replies
    1. Hi,

      with DB adapter is easy, can be tuned, proven and a fast way to retrieve data from the db. You can add it to a composite plus when it fails it always gives back an error. But reuse is less and maybe you have the same db adapter in several composites or with different db operations. So you probably need to make a seperate service layer

      ADF BC SDO is a different project/ technology, more development effort and needs to deployed first and is deployed differently than soa. But reuse is great and can be used as bind entity in BPEL.

      Hope this helps.

      Delete