Java Developer
ORACLE ADF BY FRANK NIMPHIUS
Service, Please!
Integrate Web services with Oracle ADF and
Business Components applications.
ORACLE APPLICATION DEVELOPMENT FRAMEWORK AND ORACLE JDEVELOPER
Besides being used in SOA, Web services are a common access pattern in Web
application development for remote data
queries, application integration, and application departmentalization. Rather than
enabling developers to directly access database tables owned by other lines of business,
companies can expose the services interface
to ensure data integrity and consistent application of business logic on the source data.
In this column, you will learn about the
Web services integration options available for
Oracle Application Development Framework
(Oracle ADF) applications. Stepping through a
sample application, you’ll learn how to embed
calls from Oracle ADF’s Business Components
models into Web services for create, read,
update, and delete (CRUD) operations.
WEB SERVICES INTEGRATION IN
ORACLE ADF
SOAP-based Web services and Oracle ADF
can be integrated in several different ways.
Oracle ADF’s Web Service Data Control
feature is easiest to configure at design time,
but it does not provide much control of a service’s runtime behavior, nor of the exchanged
data. Thus, using Web Service Data Control is
best for simple interactions only.
On the other hand, using the JavaBean
Data Control feature or Business Components
feature of Oracle ADF supports deeper, more
complex integration scenarios. JavaBean
Data Control can be used for integrations
involving plain-old Java objects (POJOs). For
applications that use Business Components
as the business service layer, it makes sense
to integrate the Web service application at
the Business Components service integration layer and take full advantage of Business
Components benefits such as participating
in master-detail relationships and leveraging
advanced framework features such as using
model-driven lists of values.
In the JavaBean Data Control or Business
Components approach, the Web services
are accessed through the standard Java API
for XML Web Services (JAX-WS) proxy client,
which gives you programmatic control for
manipulating data in transit. Rather than
using the JAX-WS proxy client alone, I recommend using it in conjunction with a JavaBean
wrapper. The wrapper provides a stable API for
your Business Components application integration, so that if the Web service changes,
you’ll only need to regenerate your JAX-WS
proxy client code and drop it into place.
The example provided with this column
shows you how to integrate a Web service
and a Business Components application by
using this recommended approach. Before
delving into the step-by-step development
process, let’s take a closer look at the integration architecture.
SAMPLE APPLICATION INTEGRATION
ARCHITEC TURE
The sample applications include a basic
but complete Java Platform, Enterprise
Edition Web service and a starter Business
Components application that you’ll extend
to support integration with the Web service.
The Web service obtains data from the
Departments table in the Oracle HR sample
database schema.
By default, Business Components
queries data from database tables and
views. For Business Components to work
with other datasources, such as Web services, PL/SQL stored procedures, or Java
Naming and Directory Interface (JNDI) services (LDAP, for example), developers create
programmatic view objects and entities that
override the Business Components framework default behavior.
Figure 1 shows the class hierarchy
and the integration architecture used in
the sample. The JAX-WS proxy client is
accessed from a JavaBean wrapper in the
Business Components project. The JavaBean
wrapper is accessed from methods of the
WsDepartments entity object and the
WsDepartmentsView view object.
GE T TING STARTED
To begin, download the sample application
at bit.ly/I5LIrR and unzip the file. The file
contains two folders:
•;starter-app contains two workspaces:
a completed Web services application
and a Business Components application
workspace with the JAX-WS proxy client
contained in its own project. This article
shows you how to complete the business
components in the project to integrate with