Issue intercomponent calls

You must use a proxy to issue intercomponent calls. If you call methods in another Java component directly, no server features are available to the called component, such as transaction control, instance lifecycle management, and security.

Using the CORBA ORB to instantiate proxies

To invoke other components, instantiate a proxy (stub) object for the second component, then use the stub to invoke methods on the component.

To invoke methods in other components, create an ORB instance to obtain proxy objects for other components, then invoke methods on the object references. You obtain object references for other components on the same server by invoking string_to_object with the IOR string specified as Package/Component. For example, the fragment below obtains a proxy object for a component SessionInfo that is installed in the CtsSecurity package.

    java.util.Properties props = new java.util.Properties();
    props.put("org.omg.CORBA.ORBClass",
                    "com.sybase.CORBA.ORB");
    ORB orb = ORB.init((java.lang.String[])null, props);
    SessionInfo sessInfo = 
        SessionInfoHelper.narrow
            (orb.string_to_object(
                "CtsSecurity/SessionInfo")); 

When making intercomponent calls using string_to_object, the user name of the client that executed the component is automatically used for authorization checking. The exception is when instantiating the system components in the Jaguar package: the ORB automatically switches to the system user priveleges when you specify a component in the Jaguar package. To specify a user name, use this syntax:

orb.string_to_object("iiop://0:0:user_name:password/Package/Component"));

You can retrieve the system user name and password with these methods in class com.sybase.CORBA.ORB, which both return strings:

When called from components, string_to_object returns an instance running on the same server if the component is locally installed; otherwise, it attempts to resolve a remote instance using the naming server.

Connecting to third-party CORBA servers

Your component may need to invoke methods on a component hosted by another vendor’s CORBA server-side ORB. Sybase recommends that Java components use the EAServer client-side ORB for all IIOP connections made from EAServer components. See “Connecting to third-party ORBs using the EAServer client ORB” for more information.