Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Client applications > Develop client applications


Develop ActiveX client application code

This topic provides an outline for developing an ActiveX Windows program, such as Visual Basic, VBScript, and Active Server Pages, to use the WebSphere ActiveX to EJB bridge to access enterprise beans.

This topic assumes that you are familiar with ActiveX programming and developing on the Windows platform. For information about the programming concepts of ActiveX application clients and the ActiveX to EJB bridge, refer to the ActiveX to Enterprise JavaBeans™ (EJB) Bridge topic, and related topics.

Consider the information given in ActiveX to EJB bridge as good programming guidelines. To use the ActiveX to EJB bridge to access a Java class, develop your ActiveX program to complete the following steps:


Procedure

  1. Create an instance of the XJB.JClassFactory object.
  2. Create Java virtual machine (JVM) code within the ActiveX program process, by calling the XJBInit() method of the XJB.JClassFactory object. After the ActiveX program has created an XJB.JClassFactory object and called the XJBInit() method, the JVM code is initialized and ready for use.
  3. Create a proxy object for the Java class, by using the XJB.JClassFactory FindClass() and NewInstance() methods. 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.

  5. Use the helper functions to do the conversion in cases where automatic conversion is not possible. We can convert between the following data types:

    • Java Byte and Visual Basic Byte
    • Visual Basic Currency types and Java 64-bit

  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.


Example


View a System.out message: The ActiveX to EJB bridge does not have a console available to view Java System.out messages.

To view these messages when running a stand-alone client program (such as Visual Basic), redirect the output to a file.

The following example illustrates how to redirect output to a file:

launchClientXJB.bat MyProgram.exe > output.txt


ActiveX client application using helper methods for data type conversion. Generally, data type conversion between ActiveX (Visual Basic and VBScript) and Java methods occurs automatically, as described in ActiveX to EJB bridge, converting data types. However, the byte helper function and currency helper function are provided for cases where automatic conversion is not possible.


What to do next

After you develop the ActiveX client application code, deploy and run the ActiveX application.


Related


ActiveX client programming best practices
ActiveX client programming, Java field programming tips
ActiveX client programming, Java virtual machine initialization tips
ActiveX client programming, handling error codes
ActiveX client programming, JClassProxy and JObjectProxy classes
ActiveX client programming, threading tips
ActiveX client programming, tips for passing arrays
Example: Using an ActiveX client application to access a Java class or object
Example: ActiveX client application calling Java methods
Example: ActiveX client application using helper methods for data type conversion
ActiveX to EJB Bridge
Run an ActiveX client application
Run an ActiveX client application


Related


ActiveX to Java primitive data type conversion values
A client program does not work

+

Search Tips   |   Advanced Search