The Dynamic Invocation Interface
A JAX-RPC implementation typically implements dynamic proxies by using the more primitive dynamic invocation interface (or DII for short). As well as being used internally in this way, the DII is a public API that provides another way for application code to access a web service without needing to generate stub classes. Creating an application that uses the DII involves more coding effort than using either dynamic proxies or precompiled stubs. However, the DII makes it potentially possible to write clients that can work with web services that are not discovered until runtime, in much the same way as the Java reflection feature allows software tools to call methods on classes that it does not know about at compile time.
The steps required to use the dynamic invocation interface are as follows:
A client application gets a
Serviceobject for a web service.Using the
Serviceobject, the application creates aCallobject that is used to invoke the service’s operations.Callis the central class of the DII.Methods of the
Callinterface are used to specify which operation is to be called, and to discover and list the Java and XML types of the operation’s arguments and its return types.The application invokes the operation by calling the
invoke( )method of theCallobject, which provides the result of the operation as its return value.
The Service
interface provides five methods that can be used to obtain
Call objects:
-
public Call createCall( ) throws ServiceException ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access