You are on page 1of 12

12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

Waslley Souza Blog

Using DB Adapter in SOA Suite 12c

12
When you have a BPEL Process, and it needs to perform an operation on a
Database Table, for example, insert an employee, you have to use the Database
Adapter. The Database Adapter exposes to SOA, tables and SQL transparently and
non-intrusively.

In this post, I will create a BPEL Process to insert employees into Employees table
from HR Schema. Best practises, like the use of MDS and Mediator, are not the
purpose of this post. Download the sample application: SOADBAdapterApp.zip.

Create a SOA Application.


In Step 1, set the Application Name and Application Package Prex.

In Step 2, set the Project Name.

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 1/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

In Step 3, choose Empty Composite and click Finish to create the application.

Create the XSD of employees.


In the Applications window, right-click the Schemas folder inside the Project and
choose New > From Gallery.
In the New Gallery dialog, choose SOA Tier > Interfaces > XML Schema, and click
OK.
Set the File Name and Target Namespace, and click OK.

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 2/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

Paste the following code inside XSD le:

<xsd:element name="createEmployeeRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="employee" type="employeeType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="createEmployeeResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="status" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:complexType name="employeeType">
<xsd:sequence>
<xsd:element name="firstName" type="xsd:string" minOccurs="0"/>
<xsd:element name="lastName" type="xsd:string"/>
<xsd:element name="email" type="xsd:string"/>
<xsd:element name="hireDate" type="xsd:date"/>
<xsd:element name="jobId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

Create the service contract (WSDL).


In the Applications window, right-click the WSDLs folder inside the Project and

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 3/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

choose New > From Gallery.


In the New Gallery window, choose SOA Tier > Interfaces > SOA WSDL Document,
and click OK.
In the Create WSDL dialog, complete the form and click OK.

Open the EmployeeProject le.


To create the BPEL Process, right-click Components section, and choose Insert >
BPEL Process.
In the Create BPEL Process dialog, complete the form and click OK.

To create the Database Adapter, right-click External References section, and


choose Insert > Database.
In Step 1, set the DBAdapter Name and click Next.
http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 4/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

In Step 2, choose the Database Connection, set the JNDI Name and click Next.

In Step 3, choose Insert Only option and click Next.

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 5/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

In Step 4, click Import Tables button, choose EMPLOYEES table from HR Schema,
and click Next.

In Step 5, click Next.

In Step 6, click Next.

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 6/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

In Step 7, click Search button, choose EMPLOYEES_SEQ as Sequence, and click


Next.
This way, the insert operation, will use this sequence to generate an unique key.

In Step 8, click Next.

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 7/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

In Step 9, click Finish.

Create a wire between CreateEmployeeBPELProcess and HrDbReference.

Double-click CreateEmployeeBPELProcess component to create the process ow.


Drag two Assign and an Invoke components, and drop inside the process.

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 8/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

Create a wire between Invoke and HrDbReference.


In the Edit Invoke, complete the form, create the input and output variables, and
click OK.

Double-click the rst Assign component, wire the parameters and click OK.

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 9/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

Double-click the second assign, wire a Success expression to status parameter


from output variable, and click OK.

We nished our BPEL Process!


Now, start the Integrated WebLogic Server and go to WebLogic Server
Administration Console.
Go to Services > Data Sources and create a new one.

Go to Deployments and click DbAdapter.


Go to Conguration tab and, then Outbound Connection Pools.
Click New button, choose javax.resource.cci.ConnectionFactory and create a new
Outbound Connection.

Click the Outbound Connection that you have created and set:

sequencePreallocationSize to match the increment value in your Sequence


(which is 1 by default).
xADataSourceName to JNDI Name of your Data Source.

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 10/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

Click Save.
Go to Deployments and update the DbAdapter.
Go back to JDeveloper and deploy your SOA Project to Integrated WebLogic Server.
Go to Enterprise Manager (EM) and test the service.

12

No related posts.

23 September 2014 / Oracle / BPEL

2 thoughts on Using DB Adapter in SOA Suite 12c

Pingback: SOA Community Newsletter October 2014 | SOA Community Blog

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 11/12
12/28/2016 UsingDBAdapterinSOASuite12cWaslleySouzaBlog

Pingback: Using DB Adapter in SOA Suite 12c by Waslley Souza | SOA Community
Blog

The views expressed on this blog are my own and do not reect the views of the company I work (or
have worked for) neither Oracle Corporation. The opinions expressed by visitors on this blog are
theirs, not mine. The information in this blog is written based on personal experiences. You are free
to use the information on this blog but I am not responsible and will not compensate to you if you
ever happen to suer a loss/inconvenience/damage because of/while making use of this information.

http://waslleysouza.com.br/en/2014/09/usingdbadapterinsoasuite12c/ 12/12

You might also like