Using RMI to Call a Remote Object

The RMI Lookup activity allows you to use a registry server to retrieve a Java object that implements a client stub of a remote object. You can then pass the object to a Java Code or Java Method activity and invoke methods on the object. Using the RMI Lookup activity illustrates using the RMI Lookup activity to obtain a client stub for a remote Java object and then mapping that object to an input parameter for the Java Code activity.

Figure 104: Using the RMI Lookup activity

The object obtained by the lookup activity is an instance of the server's stub class for the actual server object interface. To call methods on this object with a Java Code activity, use the stub class interface to cast the object before making the calls. Similarly, the Java Method activity should specify the stub class interface in its Class field. The generated client stub’s .jar file must be either in the ActiveMatrix BusinessWorks classpath or in an AliasLibrary resource before it can be used by the Java Method activity.