330 likes | 457 Views
CON4285 - A Whole New World: How to Build Web Services From Your Existing ADF Applications. Frédéric Desbiens Principal Product Manager Application Development Tools.
E N D
CON4285 - A Whole New World: How to Build Web Services From Your Existing ADF Applications Frédéric DesbiensPrincipal Product ManagerApplication Development Tools
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
Program Agenda • Why Should You Do This? • Service Concepts • Choosing a Web Service Style • Building Services From Your Application
Why Should You Do This? • To break application silos • Align priorities • Favour information flow • Coordinate decisions • To support your Mobile apps • To fight the development gap Development Gap Development Resources Application Needs Time
What Is a Service? • A publicized package of functionality • Can be discovered by potential consumers • Described by metadata • Usage usually governed by a service contract • Technical interface (signature) • Semantics • Non-functional requirements (SLAs, …)
What Is a Service? From a technical standpoint • Implementation • Deployed code • Configuration of the infrastructure • Interface • Means by which the service in invoked • Contract • Description (what the service provides) and constraints • Not a specific technology or platform
The Enterprise Service Bus A specific approach to build a SOA • Message-driven backbone • Abstracts communication between services • Central duties: • Messaging (store-and-forward delivery) • Data transformation (XML to XML) • Content-based routing (publish/subscribe) • « Fire and forget » pattern
Core SOA Tenets • Service decoupling • Asynchronous processing • Statelesness • Encapsulation • Service Facade pattern
Three words to know • SOAP • XML based web services protocol • REST (RepresentationalState Transfer) • Architectural style based on HTTP • JSON (JavaScript Object Notation) • Text-based format derived from JavaScript
SOAP Main characteristics • Extensible • Neutral (towards transport protocols) • HTTP • SMTP • JMS • Independent • Support for any programming model • W3C recommendation
SOAP Consuming a service Client • Client APIs are usually generated by tools from the WSDL • In JDeveloper, the WSDL will be generated for service-oriented App Modules API SOAP WSDL Definition Endpoint Service
The WS-* extensions OASIS standards • Messaging • WS-Addressing (support for non-HTTP protocols) • WS-ReliableMessaging • Security • WS-Security: integrity, confidentiality, security tokens • WS-Trust: issue, renewal and validation of tokens • WS-SecureConversation: creation and sharing of security contexts • WS-AtomicTransaction: Two-phase commit for ACID transactions
REST • Uses some of the standard HTTP methods (verbs) • GET (Retrieve) • POST (Create/Update resource subordinate) • PUT (Create/Update full resource) • DELETE (Delete) • Each resource resolves to an URI • Results should be cacheable GET http://www.oracle.com:8080/Customers/12345
REST Consuming a service Client • No standard API. • No standard definition language for the interface • JDeveloper‘s Web Service and URL Data controls mitigate both issues • We aim to make App Modules exposable as REST services in a future 12c release API HTTP Endpoint Service
JSON REST doesn’t mandate a data format. Here’s a contender • Derived from JavaScript (Data structures, Associative arrays) • Language-independent http://api.rottentomatoes.com/api/public/v1.0/movies/770672122.json?apikey=[key] { "id": 770672122, "title": "Toy Story 3", "year": 2010, "genres": [ "Animation", "Kids & Family", "Science Fiction & Fantasy", "Comedy" ], "mpaa_rating": "G", … }
Which one should I choose? • SOAP • Enterprise-grade features • Broad standardization and interoperability • Based on XML (verbose, slower to process) • REST • Simpler • Better performance and scalability
Which one should I choose? Both! It all depends on the use case • Is the service about data or business logic? • REST is a natural choice for data • SOAP is better for complex logic • Do you need the Enterprise-grade features of WS-* ? • Think about the development team • Easy to work with both in ADF Business Components 12c
Conflicting Requirements Meeting the SLA Low response time Application Clients Consumers
The service facade pattern Facade Business logic User Interface Clients Consumers Data
The service facade pattern A possible ADF implementation AM 1 JSF Lib Model VO EO VO VO VO EO VO VO Task Flows EO EO AM 2 AM n AM Facade UI Logic
EXAMPLE Graphic Section Divider
What to do? • Messages should represent forms or documents, not objects • Keep network calls at a minimum • Network transit takes time • Favour services with a high level of granularity • Consumers shouldn’t have to make several calls in a row for a single transaction
What to avoid? • Stringent SLAs for non-mission critical applications • Service calls to access local resources • Creating a service for a single consumer • Polluting messages with implementation details • Using database transactions spanning several service calls (if possible)
Conclusion Is it worth it? • Pros • Higher productivity • Better code quality • Clear separation of concerns • Encapsulation • Potential for better performance • Cons • More complex • Service layer requirements influence the application’s lifecycle
Join the Oracle ADF Community http://oracle.com/ADF @jdeveloper@BlueberryCoder JDeveloper /jdeveloper ADF Insider ADF Architecture
Learn More at Oracle OpenWorld Related sessions and labs Oracle ADF booth at the Oracle Demo Ground – Moscone South