JAX-RPC Client Invocation Models

JAX-RPC defines three different client models used to invoke a remote method: one static model and two dynamic models. The statically defined stub model is typically based on a code generation tool. The dynamic proxy invocation model is based on building a proxy object dynamically using the reflection APIs (java.lang.reflect). The Dynamic Invocation Interface (DII) is based on a Call object similar to the Apache SOAP Call interface we saw in Chapter 5.

Statically Generated Stubs

A tool can generate a class that implements the javax.xml.rpc.stub interface, which contains the following methods:

package javax.xml.rpc;
public interface Stub {
    public void _setProperty(String name, Object value);
    public Object _getProperty(String name);
    public java.util.Iterator _getPropertyNames(  );

In addition to implementing these methods, the generated stub would have a method that matches the name of the actual service method, such as getLastTradePrice( ). The underlying implementation of this method can be anything the tool and the infrastructure agree upon. It is not required to be transport-independent; in fact, stubs are usually bound directly to a transport. The methods in the Stub interface exist to allow dynamic capabilities in the static stub.

Table 7-2 lists the handful of predefined properties that can be set on the Stub class. These properties are expected to be set prior to making a method call, based on the assumption that the underlying transport or ...

Get Java Web Services now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.