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
Service
object for a web service.Using the
Service
object, the application creates aCall
object that is used to invoke the service’s operations.Call
is the central class of the DII.Methods of the
Call
interface 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 theCall
object, 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 ...
Get Java Web Services in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.