WebReference.com - Part 4 of chapter 3 from Professional Java Web Services, Wrox Press Ltd. (1/6) | WebReference

WebReference.com - Part 4 of chapter 3 from Professional Java Web Services, Wrox Press Ltd. (1/6)

current pageTo page 2To page 3To page 4To page 5To page 6
[next]

Professional Java Web Services

Developing SOAP Services

[The following is a continuation of our series of excerpts from chapter 3 of the Wrox Press title, Professional Java Web Services. The code for the examples discussed in this excerpt can be downloaded from the Wrox Web site (free registration required).]

In this section we will dive into the details of creating a SOAP service. In this section we will discuss:

In order to illustrate some of topics discussed in the chapter we will look at parts of the Job Resumé Repository System that was introduced in the previous section.

Apache SOAP Architecture

The Apache SOAP server-side facilities allow code artifacts to be accessible from SOAP clients without the code artifacts having to be SOAP-aware. This means that no code has to be added to code artifacts to make them work with Apache SOAP. So in essence, the server-side facilities of Apache SOAP act as a bridge between SOAP clients and code artifacts. The following diagram illustrates this:

Apache SOAP Server-Side facilities

To help explain how this works let's go through the process of accessing a standard Java code artifact:

  1. The Apache SOAP run-time environment has to be configured to route requests to a particular code artifact. This is known as service registration or deployment. This is done using the command-line tool or the web-based administration tool that's provided with Apache SOAP. We discussed both methods in the Deploying and Running a "Hello World" Service section.

  2. An Apache SOAP client or another SOAP 1.1-compliant SOAP client sends an RPC-based SOAP request message to the Apache SOAP runtime. This request contains the name of the service and the name of methods to invoke.

  3. The Apache SOAP runtime validates that the service is registered and that the requested methods are marked for exposure to SOAP clients. If either validation fails, a SOAP Fault message is sent back to the SOAP client.

  4. The Apache SOAP runtime dispatches the RPC method request to the code artifact.

  5. The code artifact processes the method call and sends back a return value to the Apache SOAP run-time environment.

  6. The Apache SOAP runtime packages the return value in a SOAP response message and sends it back to the client.

Pluggable Provider Architecture

Code artifacts are supported within Apache SOAP through the Pluggable Provider architecture. This is a layer of abstraction between the Apache SOAP runtime and the components that know how to interact with the code artifacts, which are called Providers. A Provider is a Java class that is responsible for locating, loading, and invoking a code artifact. It also is responsible for packaging the return value into a SOAP Envelope when necessary. Apache SOAP provides Providers for each one of the default code artifacts. Below is a diagram of the architecture:

Apache SOAP Pluggable Provider Architecture

The architecture also provides support for User-Defined Providers; these are Providers that can be developed to handle other code artifacts. This would be useful if we had some code artifacts that we developed in a non-Java language that we wanted to make available as a service and we didn't want to invest the time or money in converting them to Java. For example, we might have some C++ classes that contain functionality that we want to make available as a service. Instead of rewriting the classes we could develop a Provider that knows how to handle C++ code artifacts. Likewise, we could write a Java Messaging Server (JMS) provider.


current pageTo page 2To page 3To page 4To page 5To page 6
[next]

Created: June 5, 2002
Revised: June 5, 2002

URL: http://webreference.com/programming/java/webservices/chap3/4/