11.3 Service Provider

   

As mentioned earlier, Oracle provides two implementations for Web Services on Oracle Application Server: OracleAS SOAP and OC4J Web Services. Oracle's official stand on OracleAS SOAP, an enhanced version of the Apache organization's Java-based SOAP implementation, is that it is in maintenance mode. In other words, Oracle will continue to maintain OracleAS SOAP for the time being, but you are strongly encouraged to use OC4J Web Services instead. For that reason, we cover only OC4J Web Services and its tools in the remainder of this chapter.

11.3.1 OC4J Web Services Agents

Web Services are implemented in OC4J by seven servlets for the following seven types of service objects:


A stateless Java class

Using an RPC-style XML message


A stateless Java class

Using a document-style XML message


A stateful Java class

Using an RPC-style XML message


A stateful Java class

Using a document-style XML message


A stateless session EJB

Using an RPC-style XML message


A stateless PL/SQL stored procedure

Using an RPC-style message


Java Message Service (JMS)

Using a document-style XML message

As demonstrated in Figure 11-4, an OC4J Web Services servlet is responsible for parsing an incoming request in the form of an XML message, calling the appropriate service, encoding the result into an XML document, and then sending the XML document back to the requester through the Oracle HTTP Server.

Figure 11-4. OC4J Web Service architecture
figs/oas_1104.gif

By creating seven different servlets for these seven different service types, Oracle has simplified the process of creating a Web Service so that it consists only of programming the service method, configuring the service via an XML file, and then generating a deployment Enterprise Application Archive file. The resultant EAR file is then deployed on Oracle Application Server using Application Server Control. In addition, a different servlet for each service type makes the servlet's code base smaller and more efficient, which leads to better performance.

11.3.1.1 RPC-style versus document-style

Two styles of Web Services calls are supported:


Remote procedure calls

As mentioned earlier, an RPC is a parameterized encoding in which the parameters for a service are encoded with elements in the XML message sent to and received from the service.


Document (literal)

The document or literal style doesn't encode parameters. Instead, it sends an entire encapsulated XML document as the message payload.

11.3.1.2 Stateless Java class services

Stateless Java class services, whether they are RPC- or document-style, are provided by a Java class that has one or more public methods . Each public method is exposed as a service. An RPC-style service can use one of the many default datatypes specified in the SOAP schema. In contrast, the document-style service must receive, return, or receive and return an XML document passed as an instance of Java class org.w3c.dom.Element . OC4J maintains a cache of instances of each stateless service for reuse to increase performance.

11.3.1.3 Stateful Java class services

Stateful Java class services, whether they are RPC- or document-style, are provided by a Java class that has one or more public methods and maintains one or more instance variables . Instances of stateful services aren't cached by OC4J. Instead, they are stored in the HTTP session object for each user 's session.

11.3.1.4 Stateless session EJB services

Any stateless session EJB can be used as an RPC-style service. The public methods exposed by the EJB's remote interface are accessible as services. As with stateless Java classes, instances of stateless session EJBs are cached by OC4J for reuse.

11.3.1.5 Java Message Service services

Oracle Application Server Java Message Service and Oracle Advanced Queuing, as well as any desired third-party messaging systems, are supported by OC4J Web Services. JMS Web Services expose JMS sends and receives as services, for both queues and topics. A JMS Web Services client can act as producer or consumer.

11.3.1.6 Stateless PL/SQL services

Any Oracle PL/SQL stored procedure that is part of a PL/SQL package can be used as an RPC-style service. Both PL/SQL procedures and functions declared in a package's specification are exposed as services. These services are executed through a dedicated servlet that uses a JDBC data source to access the host database.

11.3.2 Web Services Assembler

Oracle Application Server provides a command-line tool written in Java called WebServicesAssembler.jar that packages services into a Web Services EAR file for deployment on Oracle Application Server. Using the Web Services Assembler, Web Service development becomes a matter of doing the following:

  • Creating a JavaBean, EJB, or stored procedure to provide service methods

  • Editing the Web Services Assembler configuration file, adding directives required for the type and style of service

  • Executing the Web Services Assembler to create a deployment EAR file

  • Deploying the EAR file using Application Server Control

   


Oracle Application Server 10g Essentials
Oracle Application Server 10g Essentials
ISBN: 0596006217
EAN: 2147483647
Year: 2004
Pages: 120

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net