oracle adf architecture tv - design - service integration architectures
DESCRIPTION
Slides from Oracle's ADF Architecture TV series covering the Design phase of ADF projects, considering web service integration into your ADF applications. Like to know more? Check out: - Subscribe to the YouTube channel - http://bit.ly/adftvsub - Design Playlist - http://www.youtube.com/playlist?list=PLJz3HAsCPVaSemIjFk4lfokNynzp5Euet - Read the episode index on the ADF Architecture Square - http://bit.ly/adfarchsquareTRANSCRIPT
1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Real World ADF Design & Architecture Principles Service Integration Architecture
ORACLE PRODUCT
LOGO
15th Feb 2013 v1.0
3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Learning Objectives
• At the end of this module you should be able to:
– Understand the difference between SOAP services and REST services
– Understand which releases of Oracle JDeveloper support SOAP and REST services with ADF and how to use them
– Define a service integration strategy for Oracle ADF application development projects
Image: imagerymajestic/ FreeDigitalPhotos.net
4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• Services Overview • ADF Service Integration Strategies
– JAX-WS Integration in Oracle ADF • Service Integration through ADF BC • JAX-WS Proxy Client / POJO DC • Recommended Practices
– JAX-RS Integration in Oracle ADF • Service Integration through URL DC • Service integration through POJO DC / ADF BC
5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Exercise
Image: imagerymajestic/ FreeDigitalPhotos.net
As an ADF developer, why bother?
6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Why Bother
• Enforce consistent business logic execution for multi channel access – Web, SOA, Mobile
• Shield data sources – Protect them from direct developer access
• Application partitioning – Ease of maintenance – Sharing of business logic
Exposing Web Service APIs for Business Models
7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Web services are common in web application development
and no longer SOA only.
Image: Ambro / FreeDigitalPhotos.net
8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SOAP Services
• JAX-WS – Java API for XML-Web Services – Since Java 5, replacing JAX-RPC – Support for WS annotations – Support for asynchronous WS calls
JAX-WS
9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
REST
• Representational State Transfer – Exchanges the representation of a current data object state over the web
• Design principle for stateless data transfers on the web based on unique resource addressing using HTTP – Avoids the overhead of SOAP services – Addresses resources as nouns
• Supports different data representations – Negotiated between client and server – Representation "encodes" the state of a resource at a specific point in time – A resource can have many different representations
• Image, Text , XML, JSON, etc.
10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
About JAX-RS
• Java XML API for Restful Services • Java EE standard • Jersey is reference implementation
– Bundled with Oracle JDeveloper 12c (+) – JAX-RS provides annotations for
• Resource request path definitions • HTTP method mapping to service methods • Request URL parameter mapping to input parameters • Accepted data format • Response data format • etc.
11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SOAP Services vs. Rest Services
• Self describing and discoverable • Machine understandable
– Supports intermediary machine access as required in SOA
• Require data transformation to be performed by the client – XML to JAVA using JAXB
SOAP
12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SOAP Services vs. Rest Services
• Support for different response formats • Clients negotiate representation format by sending HTTP accept
header with list of media types they are happy to process – REST services decides which format to support
• Support for human and machine interaction • Used by many popular Ajax frameworks
– SOAP is hard to use with JavaScript
• Preferred use with mobile clients – Less overhead – Security easier to implement
REST
13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• Services Overview • ADF Service Integration Strategies
– JAX-WS Integration in Oracle ADF • Service Integration through ADF BC • JAX-WS Proxy Client / POJO DC • Recommended Practices
– JAX-RS Integration in Oracle ADF • Service Integration through URL DC • Service integration through POJO DC / ADF BC
14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SOAP Service Integration in Oracle ADF
Web Service Data Control
accesses
JAX-WS Proxy Client
Web Service Implementation
WSDL
accesses JavaBean Wrapper
ADF Business Components
JavaBean Data Control
instantiate
15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
SOAP Service Integration in Oracle ADF Caching Strategies for Best Performance
Web Service Data Control
accesses
Cache
JAX-WS Proxy Client
Web Service Implementation
WSDL
accesses JavaBean Wrapper
ADF Business Components
JavaBean Data Control
instantiate
16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• Services Overview • ADF Service Integration Strategies
– JAX-WS Integration in Oracle ADF • Service Integration through ADF BC • JAX-WS Proxy Client / POJO DC • Recommended Practices
– JAX-RS Integration in Oracle ADF • Service Integration through URL DC • Service integration through POJO DC / ADF BC
17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Integration Through ADF BC
• Who – Developers using ADF BC as their business service
• Why – Seamless integration – Consistent business service API – Leverage ADF BC advanced functionality
• How – Programmatic View Object – Programmatic Entity (for CRUD operations)
Who, Why, How
18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
ADF Business Components Programmatic View Object and Entity
JavaBean Wrapper
JAX-WS Proxy Client
Entity Object CustomWsEntity
View Object CustomWsViewObject
Application Module
referenced by
exposed in
Custom WS View Object
Database View Object 2
Database View Object 1
ViewLink
19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Custom View Object and Entity
• Entity – doDML – doSelect
• View Object – create – executeQueryForCollection – createRowFromResultSet – getQueryHitCount – hasNextForCollection
Framework Methods to Override
Entity Object CustomWsEntity
View Object CustomWsViewObject
Application Module
referenced by
exposed in
20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
WS Based Programmatic View Object
• Implementing parent-child relationship between programmatic views – Create ViewLink between parent and child view – Map parent PK VO attribute to child FK VO attribute – ViewLink defines BIND_<ATTRIBUTE NAME> bind variable – Bind variable is passed as Object[] params argument to executeQueryForCollection method • Override method in custom VO IMPL class
– "params" is an Array of Array[2] • [0] name • [1] value
– Read bind variable and use in programmatic view object data query
Implementing Parent – Child Relationships
21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• Services Overview • ADF Service Integration Strategies
– JAX-WS Integration in Oracle ADF • Service Integration through ADF BC • JAX-WS Proxy Client / POJO DC • Recommended Practices
– JAX-RS Integration in Oracle ADF • Service Integration through URL DC • Service integration through POJO DC / ADF BC
22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
JAX-WS Proxy Client / POJO DC
• Who – Developers who don't use ADF Business Components
• Why (compared to WS Data Control) – Flexible and powerful – Can be used to implement caching strategies – Pre- and post-processing of data – Pagination support
• How – Create POJO Data Control from JavaBean wrapper – Optional: Implement ADF lifecycle methods
Who, Why, How
23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
JAX-WS Proxy Client / POJO DC
JavaBean Wrapper
JAX-WS Proxy Client
POJO Data Control
24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• Web Services 101 • ADF Service Integration Strategies
– JAX-WS Integration in Oracle ADF • Service Integration through ADF BC • JAX-WS Proxy Client / POJO DC • Recommended Practices
– JAX-RS Integration in Oracle ADF • Service Integration through URL DC • Service integration through POJO DC / ADF BC
25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Integration
• Use Web Service Data Control only for simple service like weather reports or stock quotes
• Use JAX-WS proxy client for all more complex services and access them from – Programmatic view object and entity if your business service is
ADF Business Components as this allows for better integration with database queried views • Use View Objects only for read only access • Use View Objects and Entities for CRUD Web Service integration
JAX-WS service
26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Integration
• Use JAX-WS proxy client for all more complex services and access them from – POJO Data Control
• If your business service is not ADF BC. • If your business service doesn't require integration into an ADF
business component model • If the WS access should be used in a bounded task flow deployed in
an ADF library for maximum reuse
JAX-WS service
27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Service Integration
• Let the business case rule! – ADF BC is not a simplification framework for
WS access • Integrate WS when and where it makes sense • WS and ADF BC have different query and transaction behavior
– If all your data sources are JAX-WS services, evaluate a POJO data control approach
– Implement strategy to ensure data queried from WS sources are locally cached for better parent-child performance
JAX-WS service
28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• Services Overview • ADF Service Integration Strategies
– JAX-WS Integration in Oracle ADF • Service Integration through ADF BC • JAX-WS Proxy Client / POJO DC • Recommended Practices
– JAX-RS Integration in Oracle ADF • Service Integration through URL DC • Service integration through POJO DC / ADF BC
29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
REST Service Integration in Oracle ADF
REST (Jersey) Client
URL Data Control
ADF Business Components
JavaBean Data Control
REST Service Implementation
accesses
accesses
30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• Web Services 101 • ADF Service Integration Strategies
– JAX-WS Integration in Oracle ADF • Service Integration through ADF BC • JAX-WS Proxy Client / POJO DC • Recommended Practices
– JAX-RS Integration in Oracle ADF • Service Integration through URL DC • Service integration through POJO DC / ADF BC
31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
REST URL / REST DC
• Who – Developers looking for simple integration of RESTful resources in Oracle ADF
applications
• Why – REST is a popular service format many public sites use as a programmer API – REST is easy to use and comes with no overhead compared to SOAP
• How – Configure URL DC with resources URI and http methods to invoke remote
resources
Who, Why, How
32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
REST URL / REST DC
URL Data Control access
REST service
ADF Connection Architecture
Noun @Path("<name>")
@GET handleQueryRequest() @POST handleCreateRequest() @ ... ...
read URI
33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• Services Overview • ADF Service Integration Strategies
– JAX-WS Integration in Oracle ADF • Service Integration through ADF BC • JAX-WS Proxy Client / POJO DC • Recommended Practices
– JAX-RS Integration in Oracle ADF • Service Integration through URL DC • Service integration through POJO DC / ADF BC
34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
REST Jersey Client / POJO DC, ADF BC
• Who – Developers who want to interact with REST response
• Why – Pre- and post-processing of data
• How – Create Jersey client from Web Application Description Language (WADL) file – Access Jersey client from POJO avoid impact when regenerating client class
Who, Why, How
35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
REST Jersey Client / POJO DC, ADF BC Jersey Client
REST Proxy Client
REST service
accesses JavaBean Wrapper
ADF Business Components
JavaBean Data Control
extend or instantiate
Noun @Path("<name>")
@GET handleQueryRequest() @POST handleCreateRequest() @ ... ...
36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Exercise
Image: imagerymajestic/ FreeDigitalPhotos.net
I need to build ADF based user interfaces for SOA Services (ESB/OSB).
Shall I use ADF Business Components to integrate the services or POJOs and the
JavaBean Data Control?
37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Exercise
Image: imagerymajestic/ FreeDigitalPhotos.net
What would be a good discriminator for when to use ADF BC and when to use
POJO?
38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Conclusion • There are several options available in ADF to
integrate Web Services • When choosing between ADF Business Components
and POJO DC (with JAX-WS and JAR-RS clients), consider – SOA Services are not developed for a specific client – Data loading from services should be optimized. In a
parent-child query you should ensure data to be loaded when a specific parent record is selected
– Application user interface developers require a consistent programming API as a contract between the client logic they build and the business service • Think "productivity"
39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Further Reading
• Oracle Magazine "Service Please" – http://www.oracle.com/technetwork/issue-archive/2012/12-jul/o42adf-1653060.html
• http://www.oracle.com/technetwork/developer-tools/jdev/documentation/index.html – Oracle JDeveloper and ADF Documentation Library – Fusion Developer Guide
• Part V Completing your Application – Using Programmatic View Objects for Alternative Data Sources
• ADF Insider Recording – http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/adf-
service-integ/adf-service-integ.html
40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.