[Enterprise Extensions only]

An overview of the ActiveX to EJB bridge

WebSphere Application Server provides an ActiveX to EJB bridge that enables ActiveX programs to access WebSphere Enterprise JavaBeans through a set of ActiveX automation objects. The bridge accomplishes this by loading the JVM into any ActiveX automation container such as Visual Basic, VBScript, and Active Server Pages. The ActiveX to EJB bridge scenario is shown in the following figure:


The ActiveX to EJB bridge scenario

The ActiveX to EJB bridge scenario. This figure shows a client program (Visual Basic, VBScript, or ASP) using ActiveX, through the ActiveX to EJB bridge, either a J2EE client container or a Java proxy, then the Java ORB, to access an Enterprise JavaBean.

There are two main environments that the ActiveX to EJB bridge runs in:

  1. Client applications, such as Visual Basic and VBScript, are programs that a user would start from the command line, desktop icon, or start menu shortcut.
  2. Client services, such as Active Server Pages, are programs that are started by some automated means like the Services control panel applet.

The ActiveX to EJB 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 ActiveX to EJB bridge, initializing the JVM.

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 ActiveX to EJB bridge, using Java proxy objects. For more information about calling methods and access fields, see ActiveX to EJB bridge, calling Java methods and ActiveX to EJB bridge, accessing Java fields.

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 EJB bridge, converting data types.

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 ActiveX to EJB bridge, handling errors.

The ActiveX to EJB 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 ActiveX to EJB bridge, using threading.