
We have seen in previous articles how DB Adapter can be used in SOA Suite to write information to Database. SOA Suite 11g provides another method to implement Entity Services: Service Data Object (SDO).
SDO provides a unified interface to access datasource, irrespective of its type, from SOA composite. This is achieved by creating Data Services with the help of ADF Business Components. At the outset, it may sound no different from previous methods. However, the difference is that the data can be accessed with the help of an entity variable within BPEL. Data is synchronized with external updates as well. Nested objects are also supported. In addition, we can enable RMI communication instead of SOAP to improve performance.
BPEL provides three constructs for this purpose:
- ADF-BC service adapter to send and receive messages from ADF BC service.
- Create Entity and Bind Entity activities.


ADF-BC Service will let process bind to an existing ADF Business Component service layer. Once ADF BC service reference is successfully created, composite.xml will contain following XML fragment:
<reference name="OrderSDO"Where
ui:wsdlLocation=http://192.160.1.5:7001/OrderSDOWebServices/OrderSDOService?WSDL>
<interface.wsdl interface="http://www.orafmwschool.com/training/sdo/app/common/#wsdl.interface(OrderSDOService)"/>
<binding.adf serviceName="{http://www.orafmwschool.com/training/sdo/app/common/}OrderSDOService"
registryName="OrderSDOApplication_JBOServiceRegistry"/>
</reference>
- wsdlLocation points to webservices exposed by ADF Business Component Application.
- registryName is constructed using <ADF BC Application Name>_JBOServiceRegistry. In the above example, OrderSDOApplication is ADF application name. This key is automatically generated and is used to look up SDO through RMI.
<bpelx:createEntity name="CreateOrderEV" variable="OrderViewEV">Once entity variable is successfully created and bound to SDO, any operation performed on the entity variable will transparently invoke appropriate ADF BC service. For example, following copy activity will transparently update CreatedBy column in ORDERS table.
<bpelx:fromExpression>bpws:getVariableData(‘inputVariable’)</bpelx:fromExpression>
</bpelx:createEntity>
<bpelx:bindEntity name="BindOrderEV" variable="OrderViewEV">
<bpelx:key keyname="ns2:OrderId">bpws:getVariableData(‘inputVariable’,'parameters’,'/ns3:createOrafmwschoolOrdersView1/ns3:orafmwschoolOrdersView1/ns2:OrderId’)</bpelx:key>
</bpelx:bindEntity>
<copy>In this tutorial, we will create an OrderSample BPEL process that creates Orders and Order Items in database with the help of SDO and ADF Business Components. We’ll implement this example in two parts:
<from variable="inputVariable" part="parameters"
query="/ns3:createOrafmwschoolOrdersView1/ns3:orafmwschoolOrdersView1/ns2:CreatedBy"/>
<to variable="OrderViewEV"
query="/ns2:orafmwschoolOrdersViewSDO/ns2:CreatedBy"/>
</copy>
- Order data services using ADF Business Components. Complete jdeveloper project can be downloaded from here.
- Order BPEL process that uses Order data services through SDO entity variable.
1. Create Order data services using ADF Business Components
- Create a new schema called “FOD”. Run dataobjects.sql to create tables as shown below.

- Create a new generic application called “OrderSDOApplication”.

- In the next step, name the project “OrderBusinessComponents” and select “ADF Business Components” from the available project technologies.

- Right click on “OrderBusinessComponents”, select “New” and then “Business Components from Tables” from Business Tier section.

- Select FOD database connection in the next screen. If not already created, create a new connection to FOD schema.


- Click OK. From next screen, select ORAFMWSCHOOL_ORDERS, ORAFMWSCHOOL_ORDER_ITEMS tables.

- Select both views from next screen.

- Accept default values in “Read-Only View Objects” and click on Next.
- Specify “OrderSDO” as the name of Application Module. Click Next in subsequent screens to arrive at Summary screen and click on Finish

- This creates an Application Module, updateable view objects as well as corresponding relationships between tables.

Service Enable OrderSDO
- Double click on OrderSDO to bring up properties page.
- Select “Services Interface” option from the next screen.

- Click on “+” icon to create new service interface. Specify meaningful namespace.

- Click Next twice to arrive at Step 3.
- Select OrfmwschoolOrdersView1 and OrafmwschoolOrderItemsView1. For each of these views, select all listed operations.


- Click Finish to generate Service Interface.

- Click on Configurations tab in the above screen and double click on OrderSDOService.

- By default, ADF Business Components use Managed Datasource available in Weblogic Server. Name of datasource is of format java:comp/env/jdbc/<DB_Connection_Name>DS. In this example, it is “java:comp/env/jdbc/FODDS”.
- Enable direct JDBC connectivity instead of using Managed Datasource. From connection type, select “JDBC URL” and leave default values. This is only for this example purpose. In production systems, using Managed Datasource is recommended.


Enable Master Detail relationship
To enable OrderSDO to process OrderItemsSDO, we need to set SERVICE_PROCESS_CHILDREN property to true in the mastser-detail association link.
- Double click on OrafmwschoolOrderItemsFk1Assoc.xml to bring up properties page. Add custom property with name: “SERVICE_PROCESS_CHILDREN” and value: “true”.

Create Deployment Profiles for Project and Application
Right click on OrderBusinessComponents project to bring up project properties page. Click on “Deployment” and then “New” to create a new deployment profile. Specify “Business Components Services Archive” for archive type and specify “OrderBCProfile” as name. Click OK.

- Select Java EE Application and specify “OrderBCServices” for Webcontext root just to make the context name short. Click OK.

- Right click on “OrderSDOApplication” and select Application Properties. Edit “OrderBusinessComponents_OrderBCProfile (EAR File)”. Specify “OrderSDO Application” as the name of application.

- We can now right click on “OrderSDOApplication” and deploy Business Components to SOA Server. This would create webservices with operations we selected in previous steps. These webservices will use standard SOAP protocol. However, in order to create transactional services, we will have to enable RMI as communication protocol.
- Application name in previous step will be used later in part-2 of this article to construct RMI lookup key: OrderSDOApp_JBOServiceRegistry.
- From Application Navigator, select weblogic-application.xml as shown below.

- Select Listeners tab. Add a new service listener with class name “oracle.jbo.client.svc.ADFApplicationLifecycleListener”.

- Right click on “OrderSDOApplication” and deploy to SOA Server.

- JDeveloper would display successful deployment message along with URL to access web application as shown below.

- Access URL http://<your_server_name>:port/OrderBCServices/OrderSDOService?WSDL to confirm successful deployment.

Complete jdeveloper project can be downloaded from here..
Part-2 of this example deals with using SDO in BPEL with the help of BC Adapter and Entity Variables. Stay tuned …
Lets build Order BPEL process to consumer ADF Business Components we created in previous example through an entity variable.
- Create an SOA project and name it “OrderSDOProcess”. Select Empty Composite from next screen and click Finish.


- Make a note of OrderSDO service WSDL we created in previous step. In my case, it is http://192.168.0.5:7001/OrderBCServices/OrderSDOService?WSDL.
- Drag and drop a BPEL Process component on to components section of composite.xml. Name it “OrderSDOProcess”. Select “Base on a WSDL” as template.

- Paste WSDL URL from previous step. In my case, http://192.168.0.5:7001/OrderBCServices/OrderSDOService?WSDL. OrderSDOService port type will be automatically populated. Click OK.

- Double click on OrderSDOProcess in composite.xml to bring up BPEL process page.

- Double click on receiveInput activity and select “createOrafmwschoolOrdersView1” as the input operation.

- Next to Variable section, click on “+” icon to auto generate input variable. Click OK.

- Receive these steps for “replyOutput” activity to select “createOrafmwschoolOrdersView1” operation and auto-create output variable. Click OK.

- Drag and drop a ADF-BC Service adapter from BPEL Services section. Fill in values as shown below. As you may have observed, Registry key is of the form <ADF BC Application Name>_JBOServiceRegistry. In previous example, we named our ADF BC application – OrderSDOApp. Click OK to create SDO partner link.

- Let us create entity variable to use our SDO service. Drag and drop “Create Entity” activity below “receiveInput”.

- Double click on CreateEntity_1 activity and click on Browse icon next to “Entity Variable” field.

- Click on “+” icon to create new entity variable. Name it “OrdersViewEV” and select type as “Element”. Select orafmwschoolOrdersViewSDO as element value as shown below. Click OK.


- Associate this entity variable with OrderSDOService partner link as shown below from next step. Click OK in next subsequent screens to go back to “Create Entity” screen.


- Select “receiveInput_createOrafmwschoolOrdersView1_InputVariable” for From element as shown below.


- Click OK in “Create Entity” screen.
- Drag and drop “Bind Entity” activity next to “Create Entity”.
- Double click on “Bind Entity” and select OrdersViewEV as entity variable. Click OK.

- Click “+” in Unique Keys section to select a unique key to bind to SDO entity variable. In our case it is going to be OrderId.
- Select OrderId from OrdersViewEV variable for Key Local Part, as shown below.


- Similarly select “OrderId” from process input variable for “Key Value” field, as shown below.


- Click OK to save and close “Bind Entity” dialog.
- Drag and drop an Assign activity between “CreateEntity_1” and “BindEntity_1”. Assign OrderId from process input variable SDO entity variable as shown below. Repeat this step for the elements of OrdersView and OrderItemsView.

- Deploy and test the process.
No comments:
Post a Comment