2
Oracle9iAS Web Services
This chapter describes the Oracle9iAS Web Services features, architecture, and implementation.
This chapter covers the following topics:
Oracle9iAS OC4J (J2EE) and Oracle SOAP Based Web Services
Oracle9i Application Server (Oracle9iAS) supports two different Web Services options, a J2EE based Web Services environment built into Oracle9iAS OC4J, and an Apache SOAP (Oracle SOAP) based Web Services environment.
The chapters in this manual describe the Oracle9iAS OC4J (J2EE) Web Services environment. This environment makes it easy to develop and deploy services using J2EE artifacts, and is moving the Oracle Web Services features toward the evolving Web Services standards included in the next release of J2EE (J2EE 1.4). The J2EE based Web Services environment includes many development and deployment features that are integrated with the advanced Oracle9iAS features.
Appendix A, "Using Oracle SOAP" describes the Oracle9iAS support for Apache SOAP (Oracle SOAP). Oracle9iAS includes support for Apache SOAP because this implementation was one of the earliest SOAP implementations and it supports many existing Web Services applications.
Oracle9iAS Web Services Features
Oracle9iAS provides advanced runtime features and comprehensive support for developing and deploying Web Services. The Oracle9iAS infrastructure includes support for the following:
Developing End-to-End Web Services
Oracle9iAS Web Services provides comprehensive support for developing Web Services, including:
- Development Environment - Oracle9iAS Web Services allows application developers to implement Web Services using J2EE components. In addition, you can use Java Classes or PL/SQL Stored Procedures to implement Web Services. Web Services inherit all the runtime and lifecycle management elements of J2EE Applications.
- Development Tools and Wizards - Oracle9iAS Web Services Developers can use the same set of command line utilities to create, package, and deploy Web Services as other Oracle9iAS Containers for J2EE (OC4J) Applications. In addition Oracle9iAS Web Services provides the Web Service HTML/XML Streams Processing Wizard that assists developers in creating an EJB whose methods access and process XML or HTML streams.
- Automatically Generating WSDL - Oracle9iAS Web Services automatically generates WSDL and client-side proxy stubs transparently. The first time the WSDL or the client-side proxy stubs are requested they are generated. After the first request, the previously generated WSDL or client-side proxy stubs are sent when requested.
- Registration, Publishing, and Discovery - Oracle9iAS Web Services provides a standards-compliant UDDI registry where Web Services can be published and discovered. The Oracle UDDI registry supports both a private and public UDDI registry and can also synchronize information with other UDDI nodes.
- Developer Simplicity - Using Oracle9iAS Web Services, developers do not need to learn a completely new set of concepts - Web Services are developed, deployed and managed using the same programming concepts and tools as with J2EE Applications.
- Business Logic Reuse - Application developers can transparently publish their J2EE Applications to new Web Services clients with no change in the application itself. Their existing business logic developed in J2EE can be transparently accessed from existing J2EE/EJB clients.
- Common Runtime Services - Oracle9iAS has a common runtime and brokering environment for J2EE Applications and Web Services. As a result, Web Services transparently inherit various services available with the J2EE Container including Transaction Management, Messaging, Naming, Logging, and Security Services.
Deploying and Managing Web Services
Oracle Enterprise Manager deploys and manages Oracle9iAS Web Services. Oracle Enterprise Manager provides the following support for Web Services:
- Deployment - Oracle Enterprise Manager provides a comprehensive set of facilities to deploy Web Services to Oracle9iAS. Oracle Enterprise Manager provides a single, consistent Deploy Applications wizard for deploying Web Services to Oracle9iAS. It accepts a J2EE .ear file, and walks you through a set of steps to get information about the application to be deployed, and then deploys the application.
- Register Web Service - The Deploy Applications wizard is only available when deploying Web Services. This step provides access to facilities for registering Web Services in the UDDI Registry.
- Browse the UDDI Registry - Oracle's UDDI Registry provides the UDDI standards compliant pre-defined, hierarchical categorization schemes. Oracle Enterprise Manager can drill-down through these categories and look up specific Web Services registered in any category.
- Monitoring and Administration - Once deployed, Oracle Enterprise Manager provides facilities to de-install a Web Service and also to monitor Web Service performance, as measured by response-time and throughput, and status, as measured by up-time, CPU, and memory consumption. Oracle Enterprise Manager also provides facilities to identify and list all the Web Services deployed to a specific Oracle9iAS instance.
- Packaging - The Web Services Assembly Tool assists with assembling the following types of Web Services: Stateless Java (including PL/SQL Stored Procedures and Functions), Stateful Java and Stateless Session EJBs.
Using Oracle9i JDeveloper with Web Services
The Oracle9i JDeveloper IDE supports Oracle9iAS Web Services. Oracle9i JDeveloper is the industry's most advanced Java and XML IDE and provides unparalleled productivity and end-to-end J2EE and integrated Web Services standards compliance.
JDeveloper supports Oracle9iAS Web Services with the following features:
- Allows developers to create Java stubs from Web Services WSDL descriptions to programmatically use existing Web Services.
- Allows developers to create a new Web Service from Java or EJB classes, automatically producing the required deployment descriptor, web.xml, and WSDL file for you.
- Provides schema-driven WSDL file editing.
- Offers significant J2EE deployment support for Web Services J2EE .ear files, with automatic deployment to OC4J.
Securing Web Services
Oracle Enterprise Manager secures Oracle9iAS Web Services in the same way that it secures J2EE Servlets running under OC4J. This provides a comprehensive set of security facilities, including:
- Complete, standards-based security architecture for encryption, authentication, and authorization of Web Services.
- Single Sign-on to enable users to access several Web Services with a single password.
- Single Point of administration to enable users to centrally manage the security for Web Services.
Aggregating Web Services
Oracle9iAS Portal facility provides the ability to aggregate Oracle9iAS Web Services within an organization into a Portal. Additionally, portlets in the Oracle9iAS Portal framework can be published as Web Services.
Oracle9iAS Web Services Architecture
The Oracle9iAS Containers for J2EE (OC4J) provides the foundation for building applications as components and supports Oracle9iAS Web Services (for RPC style Web Services). Oracle9iAS Web Services are implemented as any of the following:
- Java Classes
- Stateless Session Enterprise Java Beans (EJBs)
- Stateless PL/SQL Stored Procedures or Functions
For each implementation type, Oracle9iAS Web Services uses a different Servlet that conforms to J2EE standards to provide an entry point to a Web Service implementation. Figure 2-1 shows the Web Services runtime architecture, including the Servlet entry points.
The Oracle9iAS Web Services runtime architecture includes the following:
Figure 2-1 Web Services Runtime Architecture (RPC with Servlet Entry Points)
Text description of the illustration aswsv001.gif
About Servlet Entry Points for Web Services
To use Oracle9iAS Web Services, you need to deploy a J2EE .ear file to Oracle9iAS. The J2EE .ear file contains a Web Services Servlet configuration, and includes an implementation of the Web Service. Oracle9iAS Web Services supplies the Servlet classes, one for each supported implementation type. At runtime, Oracle9iAS uses the Servlet classes to access the user supplied Web Service implementation.
The Oracle9iAS Web Services Servlet classes support the following Web Services implementation types:
- Java Class (Stateless) - The object implementing the Web Service is any arbitrary Java class. The Web Service is stateless.
- Java Class (Stateful) -The object implementing the Web Service is any arbitrary Java class. The Web Service is considered stateful. A Servlet
HttpSession
maintains the object state between requests from the same client.
- Stateless Session EJBs - Stateless Session EJBs can be exposed as Web Services. The Web Service is considered to be stateless.
- PL/SQL Stored Procedure or Function - The object implementing the Web Service is a Java class that accesses the PL/SQL stored procedure or function. The Web Service is considered to be stateless. The Oracle JPublisher tool generates the Java access class for the PL/SQL stored procedure or function.
When a Web Service is deployed, a unique instance of the Servlet class manages the Web Service. The Servlet class is implemented as part of Oracle9iAS Web Services runtime support. To make Web Services accessible, you deploy the Web Service implementation with the corresponding Web Services Servlet.
Note:
Using Oracle9iAS SOAP, based on Apache SOAP 2.2, there is only a single instance of a single Servlet entry point for all the Web Services in the entire system. The Oracle9iAS Web Services architecture differs; under Oracle9iAS Web Services, a unique Servlet instance supports each Web Service.
|
Web Services implementations under Oracle9iAS Web Services that take values as parameters or that return values to a client need to restrict the types passed. This restriction allows the types passed to be converted between XML and Java objects (and between Java objects and XML). Table 2-1 lists the supported types for passing to or from Oracle9iAS Web Services.
Table 2-1 Web Services Supported Data Types (for Parameters and Return Values)
What Are the Packaging and Deployment Options for Web Services
Oracle9iAS Web Services are accessed as Servlets, thus, Web Services need to be assembled by configuring a web.xml
file that is a component of a J2EE .war file. Web Services implementation classes must be in the J2EE .war, .ear, ejb.jar files, or available through the classpath using standard J2EE mechanisms.
To deploy Oracle9iAS Web Services, you have the following options, depending on the implementation of the service:
- For Java Classes - a .ear file can be deployed to Oracle9iAS. The .ear file is assembled to include a .war file containing the Java classes and the Servlet declaration in the
web.xml
configuration portion of the .war file, without requiring any other J2EE artifacts.
- For Stateless Session EJBs - the .war file that configures the Web Services Serlvet Entry Point must be added to the EJB's .ear file and the .ear file can be deployed to Oracle9iAS.
- For PL/SQL Stored Procedures and Functions - the treatment is the same as for a Java class, a .ear file is assembled with a .war file containing the class can be deployed to Oracle9iAS, without requiring any other J2EE artifacts.
About Server Skeleton Code Generation for Web Services
The first time Oracle9iAS Web Services receives a request for a service, the Servlet entry point automatically does the following:
- Validates the class loading. All the classes that are required for the Web Service implementation must conform to standard J2EE class loading norms.
- Validates the data types. All the Java classes or EJBs must conform to the restrictions on supported parameter and return types as shown in Table 2-1.
- Generates server skeleton code. The server skeleton code is only generated the first time the Web Service is accessed or when the ear file is redeployed (when an application is redeployed,the server skeleton code and other Web Services support files are regenerated). The generated code is stored in the temporary directory associated with the Servlet context. The server skeleton code controls the lifecycle of the EJB (for Stateless Session EJB implementations), handles the marshaling of the parameters and return types (using SOAP RPC), and dispatches to the actual Java class or EJB methods that implement the service.
After the server skeleton class is generated, when subsequent requests for a service are received, the server skeleton directly handles marshalling and then invokes the method that implements the service (for Web Services implemented with PL/SQL stored procedures or functions, the server skeleton invokes the Java class that accesses the Database containing the PL/SQL stored procedure or function).
Understanding WSDL and Client Proxy Stubs for Web Services
Oracle9iAS Web Services provides automatic generation of a WSDL file and of client-side proxy stubs.
There are several elements to Oracle9iAS Web Services WSDL support. First, Web Services are based on interoperable XML data representations and arbitrary Java objects do not in general map to XML. Oracle9iAS Web Services supports a set of XML types corresponding to a set of Java types (see Table 2-1 for the list of supported Java types).
Second, using Oracle9iAS Web Services, an application developer does not necessarily need to statically generate the WSDL interfaces for a Web Service (although the developer can do so). The Oracle9iAS Web Services runtime can generate WSDL and client-side proxy stubs if they are not provided when a Web Service is deployed. These can be generated by the runtime on the server-side and delivered when they are requested by a Web Services client.
Optionally, Oracle9iAS also provides a set of tools to statically generate WSDL and client-side proxy stubs given a Java class or J2EE application.
Overview of a WSDL Based Web Service Client
Using Web Services, a client application sends a SOAP request that invokes a Web Service and handles the SOAP response from the service. To facilitate client application development, the Oracle9iAS Web Services runtime can generate WSDL to describe a Web Service. Using the WSDL, development tools can assist developers in building applications that invoke Web Services.
Overview of a Client-Side Proxy Stubs Based Web Service Client
Using Web Services, a client application sends a SOAP request that invokes a Web Service and handles the SOAP response from the service. To facilitate client-side application development, Oracle9iAS Web Services can generate client-side proxy stubs. The client-side proxy stubs hide the details of composing a SOAP request and decomposing the SOAP response. The generated client-side proxy stubs support a synchronous invocation model for requests and responses. The generated stubs make it easier to write a Java client application to make a Web Service (SOAP) request and handle the response.
About Universal Description, Discovery, and Integration Registry
The Universal Description, Discovery, and Integration (UDDI) specification consists of a four-tier hierarchical XML schema that provides the base information model to publish, validate, and invoke information about Web Services. The four types of information that the UDDI XML schema defines are:
- Business Entity - The top level XML element in a UDDI entry captures the starting set of information required by partners seeking to locate information about a business' services including its name, its industry or product category, its geographic location, and optional categorization and contact information. This includes support for Yellow Pages taxonomies to search for businesses by industry, product, or geography.
- Business Service - The businessService structure groups a series of related Web Services together so that they can be related to either a business process or a category of services. An example of a business process could be a logistics/delivery process which could include several Web Services including shipping, routing, warehousing, and last-mile delivery services. By organizing Web Services into groups associated with categories or business processes, UDDI allows more efficient search and discovery of Web Services.
- Binding Information - Each businessService has one or more technical Web Service Descriptions captured in an XML element called a binding template. The binding template contains the information that is relevant for application programs that need to invoke or to bind to a specific Web Service. This information includes the Web Service URL address, and other information describing hosted services, routing and load balancing facilities.
- Compliance Information - While the bindingTemplate contains the information required to invoke a service, it is not always enough to simply know where to contact a particular Web Service. For instance, to send a business partner's Web Service a purchase order, the invoking service must not only know the location/URL for the service, but what format the purchase order should be sent in, what protocols are appropriate, what security required, and what form of a response will result after sending the purchase order. Before invoking a Web Service, it is useful to determine whether the specific service being invoked complies with a particular behavior or programming interface. Each bindingTemplate element, therefore, contains an element called a tModel that contains information which enables a client to determine whether a specific Web Service is a compliant implementation.
Oracle Enterprise Manager Features to Register Web Services
When a Web Service is deployed on Oracle9iAS, you can use Oracle Enterprise Manager to register the specific Web Service and publish its WSDL to the UDDI registry and to discover published Web Services.