Overview of the ActiveX to enterprise bean bridge
WAS provides an ActiveX to enterprise bean bridge that enables ActiveX programs to access enterprise beans through a set of ActiveX automation objects. The bridge accomplishes this by loading the Java virtual machine (JVM) into any ActiveX automation container such as Visual Basic, VBScript, and Active Server Pages. The ActiveX to enterprise bean bridge scenario is shown in the following figure:
This figure shows a client program (Visual Basic, VBScript, or ASP) using ActiveX, through the ActiveX to enterprise bean bridge, either a J2EE client container or a Java proxy, then the Java ORB, to access an enterprise bean.
There are two main client environments in which the ActiveX to enterprise bean bridge runs:
Client applications
These are Visual Basic and VBScript applications that a user starts from a command line, desktop icon, or Start menu shortcut.- Client services
These are services (such as Active Server Pages) that are automatically started by some other process.
The ActiveX to enterprise bean bridge uses the Java Native Interface (JNI) architecture to programmatically access the JVM. Therefore the JVM exists in the same process space as the ActiveX application (Visual Basic, VBScript, or ASP) and remains attached to the process until that process terminates. To create a JVM, an ActiveX client program calls the XJBInit() method of the XJB.JClassFactory object. For more information about creating a JVM for an ActiveX program, see Java virtual machine initialization tips.
After an ActiveX client program has initialized the JVM, it calls several methods to create a proxy object for the Java class. When accessing a Java class or object, the real Java object exists in the JVM; the automation container contains the proxy for that Java object. The ActiveX program can use the proxy object to access the Java class, object fields, and methods. For more information about using Java proxy objects, see . For more information about calling methods see Calling Java methods. For more information about accessing fields, see Java field programming tips.
The client program performs primitive data type conversion through the COM IDispatch interface (use of the IUnknown interface is not directly supported). Primitive data types are automatically converted between native Automation types and Java types. All other types are handled automatically by the Proxy Objects For more information about data type conversion, see ActiveX to Java primitive data type conversion values.
Any exceptions thrown in Java are encapsulated and re-thrown as a COM error, from which the ActiveX program can determine the actual Java exceptions. For more information about handling exceptions, see Error handling codes for ActiveX application clients.
The ActiveX to enterprise bean bridge supports both free-threaded and apartment-threaded access and implements the Free Threaded Marshaler to work in a hybrid environment such as Active Server Pages. For more information about the support for threading, see Threading tips.