Download as pdf or txt
Download as pdf or txt
You are on page 1of 51

Introduction to Oracle Dynamic Services

Oracle Dynamic Services New Features 1-1


Objectives

At the end of this lesson, the student should be


able to describe:
• Challenges to aggregate and deliver content
• How Dynamic Services solves the problem
• Dynamic Services architecture
• Dynamic Services benefits
• Dynamic Services features

Oracle Dynamic Services New Features 1-2


Challenge: Aggregate and Deliver Content to
Portals, Exchanges, Mobile & Web Applications
Up till now this required complex custom code to
support multiple:
• Content sources
• APIs and protocols oracle.com
• Content formats
• Sessions priceline.com
• Failover plans
• Delivery channels hertz.com

Corporate
applications
& databases

Most business applications, including exchanges, portals, mobile and other Web applications
collect information from many different sources. Among other requirements, the applications
must support for each information source:
•Request and response APIs and parameters
•Content formats
•Data structures, such as ResultSets, XML, Java Objects, and others
•Protocols and session management schemes for different protocols, such as cookies, URL
rewriting, or database connections
Developers must write custom code to access each of these different resources in addition to
creating application logic.
The nature of the information accessed can also create complications. It can be fairly static,
such as an employee database, or it can be dynamic information, such as financial data in the
form of a stock price or a currency conversion factor.
Finally, these application environments often lack a standard set of services, supporting any
delivery path, for business relationship management, fail-over, persistent logging, integration
with work-flows through application triggers, security, caching and personalization.
Web applications that manually integrate the necessary capabilities are usually complex to
develop and maintain and provide little in the way of reuse of services or scalability. There is
often a lot of coding and maintenance to ensure that the content is always available, works
smoothly with the existing application, and delivers what the user needs.

Oracle Dynamic Services New Features 1-3


Solution: Oracle Dynamic Services
Service Aggregation and Delivery
• Defines content sources and processes as services
• Enables uniform access to services using XML
• Manages sessions, Applications Oracle Portal iAS Wireless
security, workflow,
failover, and service
Oracle Dynamic Services
response caching
• Multi-channel delivery,
portals, mobile, and
other web applications Database

• Allows re-use of services as components of other


apps
• Uses OID and Advanced Queuing for centralized
management, security and self-monitoring

What are Services?


Services package Web, application and database content and processes, and other services for access.
In the graphic Oracle, Priceline, Hertz and the database are example of services.
What is Dynamic Services?
Dynamic Services is a standard feature of Oracle9i that completes the infrastructure for Oracle9i to
support content aggregation and syndication for portals, exchanges, and other Internet and Mobile
applications. It consists of Java-based components and utilities for composing services from existing
web, database, and other application information sources, defining them in XML, and then publishing
through any channel.
It includes a wizard for rapidly creating services from web based information sources without writing
a single line of code.
It includes an execution engine that can combine two or more services and incorporate new business
logic. The resulting compound service enables a "building block" approach to developing web
applications.
It provides a common access method with a uniform client API, support for popular protocols and
service interfaces to isolate developers from the complexity of interacting with multiple content
sources, protocols, and delivery channels.
It uses the Oracle Internet Directory and Advanced Queuing to provide centralized management,
security, self-monitoring, automatic failover, and scaleable deployment of services.
It provides static and dynamic caching of service responses to improve response.

Oracle Dynamic Services New Features 1-4


Dynamic Services Deployment
Service Consumer Applications
XML Service XML Service
Request Response
Dynamic Services Client Library
Java PL/SQL
Thick Thin Thick
JMS Direct
Direct HTTP/HTTPS
Synch & Sync
Sync Synchronous Dynamic
Asynch Java
Java Driver to Services
Driver Driver Registry
Driver Web Server
to AQ
Oracle Dynamic Services
Client Database OID
JVM Application Server JVM JVM

Dynamic Services Client Library


The client library is written in Java is used by applications to make service requests of Dynamic
Services engine. It provides a Java and PL/SQL interface. It connects an application with the engine
by opening a connection in a fashion similar to opening a JDBC connection. Connection drivers allow
different connection paths from applications to the Dynamic Services engine. Applications register the
desired driver and then operate with the returned connection.
• Direct Java driver provides synchronous access to a Dynamic Services Engine running in a JVM
on the same system as the Service Consumer Application
• HTTP / HTTPS driver provides remote synchronous access to a Dynamic Services Engine
running in a JVM on a middle tier Application Server like Oracle9i Application Server
• JMS driverprovides remote synchronous and asynchronous access to a Dynamic Services
Engine running in a Application Server JVM using Oracle Advanced Queuing.
• PL/SQL is an optional remote synchronous interface to the Dynamic Services Engine running in
the Oracle9i Database JVM. Applications make PL/SQL calls to the Client Library PL/SQL
package which map to the Client Library Java Stored Procedures.
Dynamic Services Engine
The Dynamic Services engine:
• Accepts service requests from client applications, determines how the service needs to be
executed, sets up the service execution environment, and issues service execution requests to the
service providers
• Receives the service response from the service providers, transforms the service response for the
client, and returns it to the caller
• Requires an instance of Oracle DBMS to persistently store the registries or to mirror OID
Oracle Dynamic Services New Features 1-5
Dynamic Services Components:
Overview

Dynamic Services Engine


Applications, Resource
Input/
Portals & Output
Execution Protocol Providers
Wireless adapters adapters (Web service,
adapters
database
Dynamic Services service,
Client Library other
Registry Cache application)
DSAdmin
Utility

Service Application
DS Creation Registry Profile Registry
Assistant
Oracle Internet Directory
(OID) Server

Applications and Portals


Service Consumers that use Connection Drivers and the Dynamic Services Client Library to connect
an application with the Dynamic Services engine.
Input/Output Adapters
These adaptors perform post-processing of service requests to produce the input required by the
service and transforms the raw service output to the required service response.
Dynamic Services Engine
This is a policy and service management engine that determines how the service is executed. sets up
the execution environment, issues execution requests to the resource providers, receives the response
from the resource provider and transforms it for the client.
Service Registry
The registry is stored in an Oracle database. It provides service definitions that enable Dynamic
Services engines to set up and execute service and access distributed sources.
Application Profile Registry
The registry is stored in an Oracle database, it provides the application security profile governing
service access.
Registry Cache
This registry caches the information in the two registries.
OID
To increase scalability, install multiple Dynamic Services engines. Store the Service and Application
Profile registries in the central Oracle Internet Directory (OID) LDAP server. Performance of
Dynamic Services engines maintained by caching OID content in local LDAP servers.
Oracle Dynamic Services New Features 1-6
Execution Adapter
This adaptor executes a service request in a particular flow, minimally relaying a request to contact a
resource provider, and relaying the response.
Protocol Adapter
This adaptor transforms the standard service request to the inputs needed by the service following the
underlying protocol.
Resource Providers
This component includes providers, such as web services, database services, or other applications that
provide service content, and added value processes described by an XML Service Descriptor.

Oracle Dynamic Services New Features 1-7


Dynamic Services Components:
Extensible Adapters

• Input Adapter: XSLT


• Output Adapter: XSLT (XML->XML, HTML->XML)
• Protocol Adapter: HTTP, HTTPS, JDBC, SMTP
• Execution Adapter:
– Simple
– Failover
– Compound
– Conditional
• Service Providers can supply their own adapters
to manage specific tasks

Input adapter
The input adapter can further process the service request before sending it to the service provider.
Examples of such processing include semantic or higher-level validation of the request. The service
descriptor can optionally specify some adapter specific parameters that are validated at service
registration time, and interpreted at runtime by the adapter. The parameters for all adapters are
opaque to the service descriptor parser and service registry, and must be in XML syntax.
Output adapter
The output adapter can be used to transform the output returned by the execution adapter into an
XML document compliant with the output XML schema file specified in the service interface. The
prepackaged XSLT adapter is usually used for simple services,. For compound services, service
providers can use no adapter because the response from the execution adapter is often in the proper
format prescribed by the output XML schema file.
Protocol adapter
This adapter identifies the way that the Dynamic Services engine accesses the underlying service. For
example, a service may be accessed through the HTTP protocol, while another service may be
accessed through the JDBC protocol. The service descriptor can specify some adapter-specific
parameters which are validated at service registration time and interpreted at runtime by the adapter.
For example, for HTTP, the adapter may specify the HTTP method used and the URL that does the
actual servicing.
Execution adapter
This adaptor identifies the way in which the service has to be executed. Its responsibility is to receive
the request XML schema file and return the response from the underlying service provider. The
default execution adapter is a standard simple adapter. There can also be complex or compound
execution adapters that aggregate several services. The result of the execution adapter is the response
from the service. If the service is a simple service, the response will be in the native format of the
service. Oracle Dynamic Services New Features 1-8
Example: Using Dynamic Services Adapters to
Process a Simple Web Service Request

Oracle Dynamic Services

XML Input Execution Output XML


XML HTML
Adapter Adapter Adapter
Service (XSLT) (SIMPLE) (XSLT) Service
Request XML HTML Response
Protocol
Adapter
(HTTP)

HTTP request HTTP response


Resource Provider

Extensible Stylesheet Language Transformations (XSLT) are used to transform to or from XML data.
The adapters, written in XML, offer a spectrum of functions to assist the Dynamic Services engine in
handling or processing content. The spectrum of functions ranges from converting content from a
format to another (e.g.. converting HTML to XML), delivering content in a certain protocol (e.g.
HTTP, JDBC, etc.) to determining execution method of a service (e.g. simple, fail over, etc.).
The slide illustrates how adapters work while processing a service request in Dynamic Services. A
service request comes in through Input Adapter. XSLT is applied to convert the service request into
XML. Then, the simple Execution Adapter sends the request to the Resource Provider via HTTP
through the Protocol Adapter. The resulting HTML is again converted to XML using XSLT through
the Output Adapter. Finally, the result is returned as a service response in XML.

Oracle Dynamic Services New Features 1-9


Oracle Dynamic Services Benefits

• Lower development & maintenance costs


• Scalability: LDAP registry & component architecture
• Reliability: auditing, logging, messaging and failover
• Transparency: for applications & service providers
• Centralized management & security: Oracle Internet
Directory
• Common infrastructure for Web and mobile delivery
• Workflow integration: logging, triggers & notification
• Performance: dynamic/static cache, flexible updates
• Standards-based: Java, XML, popular protocols

Lower Development and Maintenance Costs


Atomic services can be defined with a graphical utility, reused by other applications for the same or
different purposes and combined into complex services to aggregate and further process content.
Scalability
OID allows Oracle Dynamic Services Servers to be deployed in distributed environments. Service
clients can point to one or more server instances. Servers are deployed in a symmetric fashion, so any
server can execute a request. Multiple servers can be deployed to support connected or session-
oriented applications, scaling to support as many users as desired.
Reliability
Dynamic Services provides fail-over services so applications can build a system with redundant
service providers. The Dynamic Services engine will always select the one that is working to avoid
application failure. Auditing and logging of events with triggers can also be used to notify the
administrator through Oracle Advanced Queuing messaging services
Transparency
Abstracting access to resources enables new content sources, protocols, and delivery channels without
application changes.
Service providers publish a service descriptor stored in the Dynamic Services LDAP registry that
specifies input/output definitions to access their resources.
Centralized Management and Security
Single point of management and security for the registered Internet services and applications in the
OID LDAP server. Add local synchronized mirrors as demand grows. Support for HTTPS.

Oracle Dynamic Services New Features 1-10


Workflow Integration
Persistent logging and notification services can be customized to interact with workflow systems
to link service executions to business logic.
Performance
You can schedule service execution to automatically update the service response cache during
off-peak hours.

Oracle Dynamic Services New Features 1-11


Dynamic Services Features:
Service Types

• Simple Service: Services described by an XML


descriptor
• Compound service: Encapsulate execution of
multiple services
• Failover service: Execute a list of compatible
substitute services
• Conditional service: Control the flow of service
execution

Simple Service
A simple service provides a uniform access method. It is described in an XML Service descriptor,
providing various properties about the resource to be accessed and the syntax of the service request
and response. Service requests and responses are XML documents, decoupling information access
from rendering.
Compound Services
Compound services let you encapsulate the execution of multiple services by combining them into a
directed graph of service executions. DSCompoundServiceExecutionAdaptor coordinates the
execution of the modules according to the graph specifications, triggering the module executions
through JavaBeans events
Failover Services
DSFailOverExecutionAdaptortakes as parameters an ordered list of compatible services,
which means the services respond to the same service interface. At execution time, the failover
execution adapter tries to execute the list in order, until it finds a service that executes with no
exception. If none succeed, an exception is raised.
Conditional Services
DSConditionalExecutionAdaptorcontrols the flow of execution because it executes a
specified service based on the value of a certain defined alias. Service providers can configure the
adapter with switch statements that can be nested, to specify something like a decision tree, where the
leaf elements are the IDs of the services to execute.

Oracle Dynamic Services New Features 1-12


Dynamic Services Features: Persistent
Auditing of Business and System Events

• The Dynamic Services Event Monitor provides


– Logging
– Notification
– Profiling
– Custom Services
• Uses Oracle Advanced Queuing
• Audits events with minimal overhead
• Self-monitoring of system and business events

Dynamic Services offers a persistent auditing feature in which events can be thrown during
execution and can be monitored. The monitoring process involves triggering of services to be
executed upon receipt of a certain event. These services that get triggered are called monitor
services.
A standalone monitor utility is provided to enable the process of auditing these events. Persistent
auditing is used to perform, among other tasks, service execution logging and failure notification
among other tasks.
Dynamic Services uses Oracle Advanced Queuing for scaleable delivery of event messages.
A set of default services is installed. These services are invoked by the event monitor utility.
The administrator can register service executions to be triggered upon certain conditions. Similar
customized conditional service execution is possible from an application as well. For example, if a
service execution fails, system services can log the failure into a database table, and at the same
time, send an email to the service owner notifying them of the failure. Such an approach easily
integrates with existing application work-flows, where, upon a service execution, a chain of services
follows.

Oracle Dynamic Services New Features 1-13


Putting it Together: A Complex Service
Example with System and Business Events
Execution
Notify Admin
united.com
Service Failed
Execution Use FailOver
Service.
180096hotel.com
XML XML
Splitter Merger
Service Service
Request XSLT XSLT Response

Execution Rate too Low

oanda.com Notify Customer

This is an example of a Compound Service. It checks availability of flights at united.com, the


availability of discount hotels at 180096hotel.com, and currency exchange rates at oanda.com.
In the example the 180096hotel.com service fails so a failover service is selected and a message is sent
to the Administrator. However, because the exchange rate too low a condition is tripped and the
customer is notified without reporting back the availability of flights and hotels.

Oracle Dynamic Services New Features 1-14


Dynamic Services Features:
Integration with Oracle Portal

Portal Users

• Register Services Oracle Portal Server


automatically as HTTP
Portlets Dynamic Services
• Control which Web Provider
Services to publish Oracle Dynamic Services
• Portal User settings
centrally stored
Dynamic
Services
Registry OID

This integration is based on the extensibility mechanism offered by Oracle Portal. The Oracle Portal
Web Provider interface is used to deliver content and services as portlets. Oracle Dynamic Services
includes a Web Provider that automatically makes every service in the Dynamic Services registry a
portlet, available to Oracle Portal clients. Service meta-information is published as portlet meta-
information. Oracle Portal access control and single sign-on features are mapped to Oracle Dynamic
Services.
The Portlet Provider is implemented as a Java Client of Oracle Dynamic Services that implements the
set of interfaces required by the Oracle Portal Web Provider. When asked about the set of portlets it
owns, the Web Provider forwards the call to Oracle Dynamic Services APIs. These APIs perform a
service look-up operation and return the result to the Oracle Portal. In a similar fashion, when asked
to show a portlet, the Web Provider executes the corresponding service and renders the response.
With this approach, the portlet definitions are stored by Dynamic Services in a single, centrally
managed, repository based on Oracle Internet Directory
Portlet builders also benefit from using service provider tools such as the Oracle Dynamic Services
Creation Assistant

Oracle Dynamic Services New Features 1-15


INTERNAL: Dynamic Services
Competitive Landscape
Major players
l Microsoft .NET: BizTalk Server
l IBM Web Services Development Environment
and WebSphere
l Sun ONE and iPlanet
l HP eSpeak
Niche players
l Bowstreet Web Services Factory
l WebMethods B2Bi Solution

Dynamic Services is part of Oracle’s web services offerings, so customers are more likely to look at
the solution as a whole.
Although there has been a lot of hype generated around web services, most major players do not yet
have anything in production. The closest is Microsoft and that is only regarding the tools story. IBM
has been actively participating in forming standards, however, its products are two years into the
future.
Another key differentiator between Oracle and other major players is that Dynamic Services provides
an engine that can handle complex service exection flow. None of the players in the market place has
such an execution environment.

Oracle Dynamic Services New Features 1-16


Summary

In this lesson, you learned that:


• A service is content and processes that deliver a
specialized value added functionality
• Developing and incorporating services can be
an expensive process without Dynamic Services
• Dynamic Services automates tedious and time-
consuming steps
• Dynamic Services provides components and
tools for rapid development and deployment of
new e-commerce services
• Dynamic Services is used in portal integration,
wireless, content syndication, exchanges, and
B2B applications

Oracle Dynamic Services New Features 1-17


Creating A Dynamic Service
To Access Web Content

Oracle Dynamic Services New Features 2-1


Objectives

At the end of this lesson, you should be able to


describe the processes to:
• Install Dynamic Services
• Create a simple service with the Creation
Assistant
• Register a service using the DSAdmin Utility
• Display a service results in a Portlet using
Oracle Portal
• Add the service to an application
• Describe utilities available to create, manage,
and deploy Dynamic Services
• Find service examples and tutorials on OTN

Oracle Dynamic Services New Features 2-2


Installing Dynamic Services

To do a basic installation of Dynamic Services,


perform the following steps:
1. Make sure the ds zip file is in $ORACLE_HOME
directory
2. Install the DSSYS schema by running the
dsinstall.sql script
3. Verify the installation of the DSSYS schema by
connecting as DSSYS user

Oracle Dynamic Services New Features 2-3


Creating a Dynamic Service

• To create a Dynamic Service, perform the


following steps:
1. Define a simple service with the Dynamic
Services Creation Assistant
2. Register the category for the service with the
DSAdmin utility
3. Register the service with the DSAdmin utility
4. Grant service execution privileges to a user
with the DSAdmin utility
5. Test service execution with the DSAdmin Utility
• Then, use the Dynamic Service in a portal or
application

Oracle Dynamic Services New Features 2-4


Step 1: Define a Simple Service with the
Dynamic Services Creation Assistant

Dynamic Service Creation Assistant creates simple services. In the future it will also create compound
and failover services. It generates an XML service descriptor that includes An XML document, XSL
style sheets and XSD schema descriptors. It can be used by:
• Service developers
• Content providers
• Oracle Portal developers
Use the Dynamic Service Creation Assistant to:
• Select the Web site from which to obtain service information
• Specify the inputs required by the service
• Specify the results to be returned by the service
• Enter service definition information:
• Service Name: Self-documenting name for the service
• Service ID: Unique name used by Dynamic Services
• Description: Describe the function of the service
• Release Date: Service create date.
• Version: The version number of the service:
• Service Update URL: location of service provider’s current service definition
• Service Classification: LDAP category and related keywords

Oracle Dynamic Services New Features 2-5


Enter service provider information:
• Company name
• Web site
• URL for logo
• Administrator contact information

Oracle Dynamic Services New Features 2-6


Step 2: Register the Category for the
Service with the DSAdmin Utility
$ $ORACLE_HOME/ds/bin/dsadmin

This step is only required if the category does not exist in the service registry.
The DSAdmin utility is a command line utility used to perform common administrative operations,
including:
• Register service packages
• Create new service categories
• Browse registered services
• Execute registered services
• Register new Web applications
• Unregister services
• Manage registered Web applications
• Manage access control list
It is run by executing the DSAdmin shell script or batch file which can be found in:
<ORACLE_HOME>\Ds\bin\dsadmin.bat for NT
%ORACLE_HOME/Ds/bin/dsadmin for UNIX
When you run this script, choose the direct driver to connect to a Dynamic Services engine running
inside a database. After doing so, the screen in the slide is displayed.

Oracle Dynamic Services New Features 2-7


Step 3: Register the Service
with the DSAdmin Utility

The DSAdmin utility is navigated by entering single character menu options on the command line.
After registering the category, return to the DSAdmin shell root by entering:
• X at the service management subshell
• X at registry operations.
Then, to enter registry operations, enter
• R to go to the registry operations
• S to manage services
When registering our service, specify the directory tree root that was previously created with the
Dynamic Services Creation Assistant.
The service registry is centrally stored in Oracle Internet Directory (OID) LDAP Server.

Oracle Dynamic Services New Features 2-8


Step 4: Grant Service Execution Privileges
to a User with the DSAdmin Utility

Before we can execute the newly created service, we must grant service execution privileges to
users.
An application must be registered in the Application Registry of the OID and associated with a user
that has been granted service execution privileges before it can access a service.
First, enter the consumer application management subshell within DSAdmin. To get there from the
service management subshell, enter:
• X at the service management subshell to return to the registry operations subshell
• C to enter the consumer application management subshell
• G to grant privileges
• 1 to grant privileges to a service
In the example:
• The user DSSYS is the name of the user receiving the privileges
• The ID of the newly created service is entered from the list of services displayed

Oracle Dynamic Services New Features 2-9


Step 5: Test Service Execution
with the DSAdmin Utility

Before we test the newly created service, we must create a sample request file. For the example on
the slide, the file contains the following lines of code:
<?xml version="1.0"?>
<form1 xmlns="http://quote.yahoo.com/Yahoo.com_Stock_quote/Reque
st"
xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
xsi:schemalocation=
"http://quote.yahoo.com/Yahoo.com_Stock_quote/Request
http://quote.yahoo.com/Yahoo.com_Stock_quote/Request
Yahoo.com_Stock_quote_service_req.xsd">
<stocksymbol>ORCL</stocksymbol>
</form1>
In DSAdmin, to test the services, enter:
• X at the consumer application management subshell to return to the root of DSAdmin
• X at the registry subshell
• E to go into execution operations
• S to synchronously execute the service
• The number of the newly created service from the list of services
• The file specification of the XML request file

Oracle Dynamic Services New Features 2-10


View Service Execution Results
in the DSAdmin Utility

The output of the screen shows the response XML created by service execution. This XML includes
the stock quote information requested during service creation.
Services can also be browsed and tested from the graphical Management Console, a Java Server Page
(JSP) that allows administrators to browse registered services and execute services

Oracle Dynamic Services New Features 2-11


Add the Service to
Oracle Portal

• Services are
automatically
registered as
portlets in Oracle
Portal providing
transparent
access
• Requires the
Dynamic Services
Web Provider

Now that the services is created, it can be added to Oracle Portal. It is easy to view these results in a
Web page using Oracle Portal. To incorporate our dynamic service into a Web page:
• Login to Portal30 from a browser, using a URL similar to http://mypc.myco.com/pls
• Select Logon and use the default password for Portal30, which is Portal30
• Select the Build tab
• Select Build a New Page
• Go through the Oracle Portal page creation steps to build a new Web page:
• On the first page, enter a page name and title, and then select Next
• In Step 2 of 4, keep the defaults for the page layout and select Next
• In Step 3 of 4, add portlets to a region by selecting the Add Portlet icon and selecting
the newly created portlet from the list of portlets under the portlet provider list name
"Yahoo Stock Quote Service"
• After selecting OK, return to the Oracle Portal creation sequence, Step 3 of 4 and see that the
Yahoo.com stock quote portlet has been added
• To end this process, select Finish, unless you want to select non-default values at Step 4 of the
Creation Assistant
• If not already done, when prompted to customize the portlet on the Customize screen, enter
ORCL as the default stock symbol and select OK.
If a blank screen is displayed, look for error information in the apache log file:
<ORACLE_PORTAL_HOME>/apache/apache/logs/error_log
The probable reason for the blank screen is that privileges have not been granted to the DSSYS user to
execute Dynamic Services.
Oracle Dynamic Services New Features 2-12
Add the Service to an Application

•Incorporate the Client API in the application


•To create a new Web application user in the database
instance, create a new database user:
CREATE USER serviceconsumer1
IDENTIFIED BY serviceconsumer1;
GRANT connect TO serviceconsumer1;
GRANT dsuser_role TO serviceconsumer1;
•Register a connection driver using DSAdmin
– Direct JDBC
– HTTP/HTTPS
– JMS
– PL/SQL

Dynamic Services Client Library API


This Java API is used by applications to make service requests of Dynamic Services engine. It
connects an application with the engine by opening a connection similar to a JDBC connection.
Application Profile Registry
Register application in the Application Profile Registry and associate with a user that has service
execution privileges. Create a new database (Web application) user in the database instance. The third
SQL statement in the example lets the service consumer application named serviceconsumer1
start using Dynamic Services.
Connection Drivers
These drivers allow different connection paths from applications to the Dynamic Services engine.
Using the DSAdmin utility, register the user identity associated with the application as a new Dynamic
Services service consumer application. The driver types include:
• Direct JDBC driver for synchronous access to services with Internet applications
• HTTP / HTTPS driver for remote synchronous access to services
• JMS driver for remote synchronous and asynchronous access to services
• PL/SQL
To enter the connection driver, select:
• Direct or 1 for the Direct driver because it is the only driver that allows registry manipulations
• Reg or R to enter the registry subshell
• Consumer or C to enter the consumer application profile registry subshell
• Add or A to add a new service consumer application
• A name of a previously defined database user
Oracle Dynamic Services New Features 2-13
For More Information

• See the Oracle Technology Network (OTN) URL:


http://technet.oracle.com/products/
dynamic_services/
• Tutorials using the Service Creation Assistant
• Example services provided with the Dynamic
Services kit as
• Oracle Portal Developers Kit with information and
tutorials to create Portlets using Dynamic Services

Oracle Dynamic Services New Features 2-14


Summary

In this lesson you learned how to:


• Create a service with the Creation Assistant
• Register a service using the DSAdmin Utility
• Display a service results in a Portlet using
Oracle Portal
• Describe Utilities available to create, manage,
and deploy Dynamic Services
• Find service examples and tutorials on OTN

Oracle Dynamic Services New Features 2-15


Service Description Implementation:
Advanced Service Concepts

Oracle Dynamic Services New Features 3-1


Objectives

At the end of this lesson, you should be able to:


• Describe how a service is implemented
• Describe how to implement each service type
• Describe the process to enable auditing and
event monitoring
• Describe how to use Oracle Internet Directory
to enhance Dynamic Services scalability

Oracle Dynamic Services New Features 3-2


Dynamic Services Service Types

• Simple Service: Services described by an XML


descriptor
• Compound service: Encapsulate execution of
multiple services
• Failover service: Execute a list of compatible
substitute services
• Conditional service: Control the flow of service
execution

A Simple Service
A Simple Service provides a uniform access method. It is described in an XML Service descriptor,
providing various properties about the resource to be accessed and the syntax of the service request
and response. Service requests and responses are XML documents, decoupling information access
from rendering.
Compound Services
Compound services let you encapsulate the execution of multiple services by combining them into a
directed graph of service executions. DSCompoundServiceExecutionAdaptorcoordinates the
execution of the modules according to the graph specifications, triggering the module executions
through JavaBeans events
Failover services
DSFailOverExecutionAdaptortakes as parameters an ordered list of compatible services,
which means the services respond to the same service interface. At execution time, the failover
execution adapter tries to execute the list in order, until it finds a service that executes with no
exception. If none succeed, an exception is raised.
Conditional services
DSConditionalExecutionAdaptorcontrols the flow of execution because it executes a
specified service based on the value of a certain defined alias. Service providers can configure the
adapter with switch statements that can be nested, to specify something like a decision tree, where the
leaf elements are the IDs of the services to execute.

Oracle Dynamic Services New Features 3-3


A Service Package

• Manifest file: a text file that identifies service


descriptor document location
• Service descriptor: an XML document describes
the elements of a service
• Classification file: an XML document that contains
service classification for OID
• Service contact files: XML documents that contain
service provider contact information
• Request and response format files: .XSD files that
contain format of request and response data

Bundling Services
A service is bundled into a simple service package and structured as a local directory that contains files
that define the service.
Service Package
A Service Package is a local directory containing the following files:
• Manifest: text file that points to the service descriptor file
• ServiceDescriptor.xml: XML file containing pointers to the files listed below. It also
also describes in its service body section how the four types of service adapters are to be used:
Input Adapter, Output Adapter, Protocol Adapter, and Execution Adapter.
• myService-Classification.xml: XML file containing classification information for
the service from the service provider
• myService-Organization.xml: XML file containing Resource Provider information
about the organization
• myService-Contact_1.xml: XML file containing Resource Provider’s contact
information in the organization
• myService-Req.xsd: XML Schema Descriptor (XSD) file defining format of request data
• myService-Resp.xsd: XSD file defining format of response data
Compound Service Package
A compound service package contains multiple services and has everything a simple service package
has plus a JAR (Java archive) file containing all Java classes and property files needed by the
compound service. The JAR file, compoundService-Adaptors.jar, is only required for non-
simple services such as compound and failover services.
Oracle Dynamic Services New Features 3-4
Steps to Manually Create or Customize
A Simple Service Package

1. Create a service package


2. Edit the service provider information
3. Edit the service provider classification
4. Create a service request definition XML schema
5. Create a service response definition XML
schema
6. Edit the service descriptor file, including the
– service header
– file service body sections
7. Test the execution of the service

Lesson two described how the Service Creation Assistant and the ADMIN utility can be used to
quickly develop your own service.
Use the following steps to manually create or customize a simple service.
1. Create a service package using the example provided with the kit
2. Edit the service provider organization and contact XML files
3. Edit the service provider classification XML file
4. Create your XML schema file for the service request definition
5. Create your XML schema file for the service response definition
6. Edit the service descriptor file, including:
• Service header
• Service body sections
7. Test the execution of your service
See the Users Guide, chapter six for a complete example.

Oracle Dynamic Services New Features 3-5


Elements of a Simple Service Descriptor

• <SERVICE HEADER>: Service naming,


classification, service provider information,
Caching parameters, service interface
• <INPUT>: Input adapter and its parameters
• <EXECUTION>: Execution adapter and its
parameters
• <PROTOCOL>: Protocol adapter and its parameters
• <OUTPUT>: Output adapter and its parameters

The service descriptor file also describes in its service body section how the four types of service
adapters are to be used to do any of the following:
• Input adapter: handles the submitted service request
• Protocol adapter: adapts the XML service request to the communication protocol used by the
remote service provider
• Execution adapter: determines the execution flow of a service
• Output adapter: transforms the raw response returned by the remote service provider into a
service XML response

Oracle Dynamic Services New Features 3-6


Execution Adapters

• Identifies how a service is executed


• Receives the request XML schema file
• Returns the response from the service provider
• Execution adapter types:
– Simple is the default
– Compound
– Conditional
– Failover

The execution adapter specification identifies the way in which the service has to be executed. It
receives the request XML schema file and returns the response from the underlying service provider.
The default execution adapter is a standard simple adapter. There can also be complex or compound
execution adapters that aggregate several services.
For the identified adapter, the service provider has the option of specifying some adapter-specific
parameters in the PARAMETERS element in the adapter specification, which are validated at service
registration time and interpreted at runtime by the adapter.
The result of the execution adapter is the response from the service. If the service is a simple service,
the response will be in the native format of the service provider.
For example, for a Web-based service, the response may be in HTML format. If the service is a
compound service, the response will be a structured service response.
Usually, if the service is a simple service, a service provider will use the default prepackaged simple
adapter.
For complex and compound service execution, the service provider can use the supplied compound
execution adapter or DSFailOverExecutionAdaptoror
DSConditionalExecutionAdaptorto greater advantage.

Oracle Dynamic Services New Features 3-7


Compound Execution Adapter

• Take one or more services and combine the


results by performing operations on them to
generate a single result
• Take output of one service as input to another
service

Compound Service
Service 1
XML XML
MsgSplitter MsgMerger
Service Service
Request Service 2 Response

A compound service allows you to encapsulate the execution of a multitude of services by


combining them into a directed graph of service execution.
DSCompoundServiceExecutionAdaptoruses the dependencies on the inputs of each of the
modules to coordinate the execution flow, and creates the necessary threads to allow for parallel
execution, if necessary.

Oracle Dynamic Services New Features 3-8


Controlling the Flow of a Compound Service

DSCompoundServiceExecutionAdaptor coordinates
control of execution flow among the four
CompoundEAModules:
• compound.ServiceExecution: Executes one
service
• compound.MessageTransformer: Transforms
service messages to either requests or responses
• compound.MessageSplitter: Splits the service
request into multiple requests for parallel execution
• compound.MessageMerger: Combines the
responses from all the services into one response

There are four possible modules that can be used in an execution graph. Each of the modules is
designed as a JavaBean with exposed properties that are set at compound service design time and
persist through runtime to control execution. DSCompoundServiceExecutionAdaptor
coordinates the execution of the modules according to the graph specifications, triggering the
module executions through JavaBeans events. The four available modules are:
• oracle.ds.engine.ea.compound.ServiceExecutionexecutes one service. It
accepts an array of messages, interpreting them as requests, and produces another array of
messages composed of responses returned by the service executions.
• oracle.ds.engine.ea.compound.MessageTransformertransforms service
messages to either requests or responses. It takes an XSLT stylesheet as a property in its
properties element, and applies that XSLT stylesheet to all the incoming service messages to
produce a list of outgoing services messages.
• oracle.ds.engine.ea.compound.MessageSplittersplits the service request
into multiple requests for parallel execution with one or more transformations as needed using
XSLT stylesheets
• oracle.ds.engine.ea.compound.MessageMergercombines the responses from
all the services into one response and then applies an XSLT stylesheet to transform that
message.

Oracle Dynamic Services New Features 3-9


Conditional Execution Adapter
• DSConditionalExecutionAdaptor executes
services according to business requirements
• Requirements can be based on service request or
user profile properties
Conditional Execution Adapter

gold
gold Service_
Service_
00
Switch
Switch on
on silver Service_1
silver Service_1
“customer.sta
“customer.sta
tus”
tus”
bronze
bronze Service_2
Service_2

DSConditionalExecutionAdaptoris an execution adaptor that controls the flow of


execution because it executes a specified service based on the value of a certain defined alias.
Aliases are used to create a map that can translate the parameters embedded in the XML service
request document to actual parameters needed by the communication protocol of the service
Service providers can configure the adapter with switch statements that can be nested, to specify
something like a decision tree, where the leaf elements are the IDs of the services to execute.
For each switch element there is an attribute called on that you must specify to tell the adapter
which alias to switch on. In this case, only the alias is referenced, thus the value of this attribute
should be just the alias name rather than {@alias}. The {@alias} value means preprocessing
the value and using the value of the alias.
For each case element under a switch element, there is an attribute called value that you must
specify to tell the adapter which match of the alias brings you to the inside of the case element.
Inside the case element there can be either an execute element, which means that you have either
reached a leaf and that its element value is the ID of the service to be executed, or you have reached
another nested switch statement.

Oracle Dynamic Services New Features 3-10


FailOver Execution Adapter

• Implement using the execution FailOver Service


adapter:
DSFailOverExecutionAdaptor
• Adapter parameters include an
ordered list of services
possessing the same service
interface XService 1 Service 2

• If the primary service fails the


adapter attempts to execute the
first available service on the list

DSFailOverExecutionAdaptortakes as parameters an ordered list of compatible services,


which means the services respond to the same service interface. At execution time, the failover
execution adapter tries to execute the first one in the list; if it fails, it moves to the second list item,
and so on, until it finds a service that executes with no exception. If none succeed, an exception is
raised.

Oracle Dynamic Services New Features 3-11


Implement Persistent Auditing and
Event Monitor Services
• A standalone monitor utility starts and stops
the event monitor
• dsmon on Unix, dsmon.bat on Windows NT
• Event Monitor can watch or log events and act
upon them
• Logged information:
– Can be used for other services.
– For example, Dynamic Services can send
notification to users, or trigger other
services to react
• Useful for statistical information gathering and
system management

Dynamic Services offers a persistent auditing feature in which events that can be thrown during
execution, can be monitored. The monitoring process involves triggering of services to be executed
upon receipt of a certain event. These services that get triggered are called monitor services. Events
can be logged into the database and queried by administrators.
The result of monitoring often leads to other services being triggered, such as failure notification.
The services that get triggered are called monitor services.
In addition to the DSAdmin command line utility, there is also an event monitor command-line tool
called dsmon, dsmon.bat on Windows NT. This tool lets you start and stop the event monitor and
have control over the output level of the messages during the execution of the monitor services.

Oracle Dynamic Services New Features 3-12


Install Persistent Auditing and Event
Monitor Services
• Configure Oracle Advanced Queuing
aq_tm_processes = 1

• Configure the MonitorInstall.dss file


bin/dsadmin -i \
etc/dsadmin/MonitorInstall.dss

• Install Monitor Services


sqlplus DSSYS/<DSSYS-password>
SQL> @dsmoninstall.sql

Because Dynamic Services makes use of Oracle Advanced Queuing for delivering event messages,
you must also set the dynamic init.ora parameter AQ_TM_PROCESSES for your database instance
to a non-zero value.
Configure the MonitorInstall.dssfile in the etc/dsadmin directory to point to the
database where the monitor services will write information. Most of these monitor services are
database services that just load some processed information into tables. Make this the same database
as the one used for the Dynamic Services engine instance.
The script dsmoninstall.sql installs a set of default monitor services from the
etc/services directory as entries into tables under the DSSYS schema.

Oracle Dynamic Services New Features 3-13


Enable Persistent Auditing and Event
Monitor Services

• At the command line, start the Event Monitor


dsmon -u dssys/dssys@Direct -e start
• In SQL*Plus, enable Persistent Auditing
CONNECT dssys/dssys
EXEC DS_Properties.setProperty (
'DS_EV_LOGGING_ENABLED',
'TRUE' );
COMMIT;
• Make SQL queries to retrieve logging events from
the database that are thrown during service
execution

In addition to the DSAdmin command line utility, there is an event monitor command-line tool called
dsmon, or dsmon.bat on Windows NT. This tool lets you start and stop the event monitor, which
executes monitor services upon receipt of events published by the Dynamic Services engine. Monitor
services are services that are associated with a monitor and conform to a service interface called
EventHandlerTemplate.
Using the event monitor utility, you can connect to an Oracle Dynamic Services engine; start or stop
the monitor; and have control over the output level of the messages during the execution of the
monitor services.
The next step is to enable persistent auditing. With the default installation in dsinstall.sql,
event messages are disabled in the properties table. The example shows the setProperty PL/SQL
procedure calls that enable event logging for the logging and warning event types.

Oracle Dynamic Services New Features 3-14


Query Events Logged by Persistent
Auditing and Event Monitor Services
• Sample query:
SELECT TO_CHAR(t.base.time_stamp, 'HR24:MI:SS')
AS timestamp,
t.base.consumer_id AS cnsmr,
t.operation AS operatn,
t.base.service_id AS service,
t.status AS status
FROM raw_logging_table t
ORDER BY t.base.time_stamp;

• Sample output:
TIME CNSMR OPERATN SERVICE STATUS
-------- ----- ------- --------------------------------- ------
12:05:20 DSSYS CONNECT OPEN
12:05:33 DSSYS LOOKUP OPEN
12:05:33 DSSYS LOOKUP CLOSE
12:05:36 DSSYS EXECUTE urn:com.cnnfn:finance.portfolio03 OPEN
12:05:53 DSSYS EXECUTE urn:com.cnnfn:finance.portfolio03 CLOSE
12:06:23 DSSYS CONNECT CLOSE

One of the monitor services that is used is called the logger monitor service. It loads a logging event
message into a raw log table in the database. The example on the slide queries this table for messages.
In the slide, there are three operations. Each operation is opened and closed.

Oracle Dynamic Services New Features 3-15


Increase Scalability:
Multiple Engines and a Central OID Registry

Multiple Dynamic Services engines can communicate


with a central Lightweight Directory Access Protocol
(LDAP) registry.
• Any engine can:
– Register a service in the central registry
– Broadcast a synchronize message to all
other engine instances
• All other instances of Dynamic Services
engines synchronize their local registry cache
with the central registry

Oracle Dynamic Services New Features 3-16


Install OID as the Master Registry

• Start Oracle Internet Directory


• Install the Dynamic Services LDAP Schema
ldapmodify -D "cn=orcladmin" -w "welcome"\
-v -c -f \
$ORACLE_HOME/ds/ldif/oiddsschema.ldif

• Create Default Entries for Dynamic Services


ldapmodify -D "cn=orcladmin" -w "welcome"\
-v -c -f \
$ORACLE_HOME/ds/ldif/oiddsdit.ldif

The first step is to ensure the OID directory is running. To start OID LDAP servers:
oidmon connect=OIDDB1 sleep=10 start
oidctl connect=OIDDB1 server=oidldapd instance=1 start
where OIDDB1 is the system identifier (SID) of the database instance created by the OID installer.
Run the ldapmodify command to install the Dynamic Services LDAP schema, using the input
file oiddsschema.ldif. This procedure creates Oracle Dynamic Services schema. The
ldapmodify command options include the following:
• -h is the host machine where OID is running, for example: oracledev1-
sun.us.oracle.com
• -p is the port number on which OID is listening, with a default of 389
• -D is the user name, for the default administrator for OID it is "cn=orcladmin"
• -w is the password for the user, for the default administrator for OID it is welcome
• -v runs the command in verbose mode, which displays additional information as the
command executes
• -c indicates that warning or error messages are viewed at the end of the command
• -f is the location of the schema file to be uploaded to OID.
Then create the default entries for Dynamic Services by using oiddsdt.ldif. This script file
creates Oracle Dynamic Services attributes, an index on those attributes, and object classes.

Oracle Dynamic Services New Features 3-17


Configure OID as the Master Registry

• Configure the Dynamic Services registry for OID:


BEGIN
DS_Properties.setProperty (
'oracle.ds.registry.defaultRegistry',
'oracle.ds.registry.DSMasterMirrorRegistry');
DS_Properties.setProperty (
'oracle.ds.registry.ldap.providerurl',
'ldap://your.ldap.server:389');
END;

• Optional steps with the DSAdmin utility


DSAdminShell.Registry.Engine subshell:
– Register the engine with the master mirror
repository
– Browse through the management directives

To enable an instance of the Dynamic Services engine to communicates with the master OID server,
you must change some properties in the properties table. This is done in the script ds_ldap.sql.
On the slide, the first call instructs the instance to go to an OID server for a master repository of the
registry rather than to itself. The default value that was set during installation is
oracle.ds.registry.DSSimpleRegistry.
The second call points your instance to the correct OID server for its registry communications.
Change your.ldap.server in the example to the host name of the machine that is running
Oracle Internet Directory.
Optional steps include:
• Run the DSAdmin utility and go to the DSAdminShell.Registry.Engine subshell to register
your engine with the master mirror repository. This step is needed only for management
purposes.
• Browse the DSAdminShell.Registry.Engine subshell to see the directives available to manage
the list of engines that communicate with the master mirror repository.

Oracle Dynamic Services New Features 3-18


Summary

In this lesson you learned that:


• There are four types of services
• A service is defined through its service package
• The service types are implemented through
execution adapters
• Service events can be managed through
auditing and monitoring
• Multiple Dynamic Services engines can be
deployed with Oracle Internet Directory for
scaleable deployment.

Oracle Dynamic Services New Features 3-19

You might also like