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 AgentsWeb Services are implemented in OC4J by seven servlets for the following seven types of service objects:
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 architectureBy 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-styleTwo styles of Web Services calls are supported:
11.3.1.2 Stateless Java class servicesStateless 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 servicesStateful 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 servicesAny 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 servicesOracle 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 servicesAny 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 AssemblerOracle 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:
|