SCDJWS Study Guide: JAX-RPC
JAX-RPC High Level Architecture
Java API for XML-based RPC (JAX-RPC) is intended to be a Java API to
expose remote procedure calls that use XML to business applications
that occur primarily, though not exclusively, on the periphery of
organizations. The need for such synchronous API increases as
corporations begin to communicate with other business partners using
disparate hardware and software systems.
The following Figure shows the high-level architecture of the
JAX-RPC implementation. The service side contains a JAX-RPC service
runtime environment and a service endpoint. The client side
JAX-RPC client runtime environment and a client application. The remote
procedure calls use an XMLbased protocol, such as SOAP, as the
application protocol, and they use HTTP as the transport protocol. The
JAX-RPC client and service runtime systems are responsible for sending
and processing the remote method call and response, respectively. The
JAX-RPC client creates a SOAP message to invoke the remote method and
the JAX-RPC service runtime transforms the SOAP message to a Java
method call and dispatches the method call to the service endpoint.
SOAP defines the XML-based protocol for exchange of information in a distributed environment, specifying the envelope structure, encoding rules, and a convention for representing remote procedure calls and responses. JAX-RPC hides the details of SOAP from the developer because the JAX-RPC service/client runtime environments perform the mapping between remote method calls and SOAP messages. The JAX-RPC runtime system also provides APIs for accessing Web services via static stubs (local objects that represent the remote services) and for invoking Web services dynamically through the Dynamic Invocation Interface (DII). No matter which invocation model is used, the client application’s request passes through the client-side JAX-RPC runtime. The client JAX-RPC runtime maps the request’s Java types to XML and forms a corresponding SOAP message for the request. Also, JAX-RPC client-side runtime responsed to send the SOAP message acros the network to the server. On the server side, the JAX-RPC runtime receives the SOAP message for the request. The server-side JAX-RPC runtime applies the XML to Java mapping, then maps the request to the corresponding Java method call, along with its parameters.
Note that the client of a JAX-RPC service may be a non-Java client. Also, JAX-RPC can interoperate with any Web Service, whether that service is based on JAX-RPC or not. Also note that developers need only deal with JAX-RPC APIs; all the details for handling SOAP happen under the hood.
Development of Web Service and Client Application :
- Defining a service interface that declares methods that clients can invoke on the remote service.
- Writting a Java class that implements the interface.
- Deploying the service to the Web server.
- Writing the client application that interacts with the service.