JAX-RPC





JAX-RPC

The Java API for XML-based RPC (page 305) (JAX-RPC) makes it possible to write an application in the Java programming language that uses SOAP to make a remote procedure call (RPC). JAX-RPC can also be used to send request-response messages and, in some cases, one-way messages. In addition to these conventional uses, JAX-RPC makes it possible for an application to define its own XML schema and to use that schema to send XML documents and XML fragments. The result of this combination of JAX-RPC and XML Schema is a powerful computing tool.

The Java programming language already has two other APIs for making remote procedure calls, Java IDL and Remote Method Invocation (RMI). All three have an API for marshalling and unmarshalling arguments and for transmitting and receiving procedure calls. The difference is that JAX-RPC is based on SOAP and is geared to Web services. Java IDL is based on the Common Object Request Broker Architecture (CORBA) and uses the Object Management Group's Interface Definition Language (OMG IDL). RMI is based on RPC where both the method calls and the methods being invoked are in the Java programming language—although with RMI over IIOP, the methods being invoked may be in another language. Sun will continue its support of CORBA and RMI in addition to developing JAX-RPC, as each serves a distinct need and has its own set of users.

All varieties of RPC are fairly complex underneath, involving the mapping and reverse mapping of data types and the marshalling and unmarshalling of arguments. However, these take place behind the scenes and are not visible to the user. JAX-RPC continues this model, which means that a client using XML-based RPC can invoke remote procedures or do SOAP messaging by simply making Java method calls.

1 Using JAX-RPC

JAX-RPC makes using a Web service easier, and it also makes developing a Web service easier, especially if you use the J2EE platform. An RPC-based Web service is basically a collection of procedures that can be called by a remote client over the Internet. The service itself is a server application deployed on a server-side container that implements the procedures that are available for clients to call. For example, a typical RPC-based Web service is a stock quote service that takes a SOAP request for the price of a specified stock and returns the price via SOAP.

A Web service needs to make itself available to potential clients, which it can do, for instance, by describing itself using the Web Services Description Language (WSDL). A consumer (Web client) can then do a lookup of the WSDL document to access the service.

Interoperability across clients and servers that have been described using WSDL is key to JAX-RPC. A consumer using the Java programming language can use JAX-RPC to send its request to a service that may or may not have been defined and deployed on a Java platform. The converse is also possible, that is, a client using another programming language can send its request to a service that has been defined and deployed on a Java platform. This interoperability is a primary strength of JAX-RPC.

Although JAX-RPC implements a remote procedure call as a request-response SOAP message, a user of JAX-RPC is shielded from this level of detail. So, underneath the covers, JAX-RPC is based on SOAP messaging.

JAX-RPC is the main client and server Web services API, largely because of its simplicity. The JAX-RPC API is simple to use and requires no set up. Also, JAX-RPC focuses on point-to-point SOAP messaging, the basic mechanism that most Web services clients use. Although it can provide asynchronous messaging and can be extended to provide higher quality support, JAX-RPC concentrates on being easy to use for the most common tasks. Thus, JAX-RPC is a good choice for applications that wish to avoid the more complex aspects of SOAP messaging and for those that find communication using the RPC model a good fit.

JAX-RPC is not yet final. The specification is still being fine tuned, and the latest draft includes features such as interceptors and Servlet JAX-RPC endpoints. In future releases of the Java WSDP, this introductory overview will be expanded to reflect JAX-RPC more fully.


 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows