[Enterprise Extensions only]

Developing an ActiveX program to use the ActiveX to EJB bridge

This topic provides an outline of developing an ActiveX program, such as Visual Basic, VBScript, and Active Server Pages, to use the WebSphere ActiveX to EJB bridge to access Enterprise JavaBeans. For more information about the concepts behind the steps involved, see the related topics.

This topic assumes that you are familiar with ActiveX programming. You should also consider the information given in ActiveX to EJB bridge, good programming guidelines.

To use the ActiveX to EJB bridge to access a Java class, develop your ActiveX program to complete the following steps:

  1. Create an instance of the XJB.JClassFactory object.
  2. Create a JVM within the ActiveX program's process, by calling 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 the ActiveX program has created an XJB.JClassFactory object and called the XJBInit() method, the JVM is initialized and ready for use.

  3. Create a proxy object for the Java class, by using the XJB.JClassFactory FindClass() and NewInstance() methods.
    For more information about creating and using Java proxy objects, see ActiveX to EJB bridge, using Java proxy objects.

    The ActiveX program can use the proxy object to access the Java class, object fields, and methods.

  4. Call methods on the Java class, using the Java method invocation syntax, and access Java fields as required.
    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.
  5. Make use of the helper functions provided for conversion between Java Byte and Visual Basic Byte data types, and between Visual Basic Currency types and Java 64-bit data types, cases where automatic conversion is not possible.
  6. Implement methods to handle any errors returned from the Java class. In Visual Basic or VBScript, use the Err.Number and Err.Description fields to determine the actual Java error.