Structure support

EAServer component interfaces can use IDL structures as parameter types in method definitions. For example, in the home interface for an EJB entity bean component, findByPrimaryKey method typically accepts a structure that represents the primary key for a database row.

ActiveX mapping for IDL structures

An IDL structure is mapped to an IDispatch interface, with every data member in the structure being mapped to a property in the corresponding IDispatch interface. All types supported by the ActiveX proxy are supported as members inside a structure, including structures and sequences.

If an EAServer component interface uses IDL structures, EAServer Manager generates IDispatch interfaces for each IDL structure when generating type libraries for the component interface definitions.

Example: using a structure in Visual Basic

bookStore::custCreditKey is an IDL structure defined in the IDL fragment below:

module bookStore
{
    struct custCreditKey
    {
        string custName;
        string creditType;
    };
};

To use this type in Visual Basic, you must first create a reference to the type library generated by EAServer Manager to represent the bookStore IDL module. In Visual Basic code, you can create an instance of the structure and set the fields like this:

Set pKey = New bookStore.custCreditKey
pKey.creditType = "VISA"
pKey.custName = "Morry"

NoteExplicit version implicit field initialization Structure fields that use complex types such as struct, union, object, date, time, or timestamp must be initialized explicitly. If you do not initialize these fields before passing the union as an EAServer method parameter or return value, the ActiveX dispatcher throws a marshalling exception. Fields of other types are implicitly set to a default value.