Siebel eScript Language Reference > Siebel eScript Commands > The Global Object >

CORBACreateObject() Method


CORBACreateObject binds a specified CORBA object and returns its object handle.

Syntax

CORBACreateObject(instanceName[, objectName][, serverName])

Parameter
Description
instanceName
The name of the interface as declared in the IDL file
objectName
The name given to the CORBA object
serverName
The fully qualified IP address of the server to connect to

Returns

The object handle of the CORBA object.

Usage

Only the instanceName parameter is required. The serverName parameter may be specified either as an IP address in nnn.nnn.nnn.nnn form or as a fully qualified network name for the host computer. Valid types are strings, numbers, and object pointers.

NOTE:  Objects instantiated with CORBACreateObject do not support methods with out or in/out parameters.

The optional parameters, which are valid only with the Visibroker ORB, provide greater specificity regarding the object to connect to. Thus, for example:

var cObj = CORBACreateObject("Account")

connects to the first account object found. Alternatively:

var cObj = CORBACreateObject("Account", "Bus_Server")

connects to the first object it finds named Bus_Server that contains an account object. If no object named Bus_Server is found, the method fails.

var cObj = CORBACreateObject("Account","", 111.17.2.18)

looks for an account object on the server with the IP address 111.17.2.18. If that server does not contain an account object, the method fails.

If you are using the Visibroker ORB, you must have IREP (an interface repository utility) running. IREP is part of the Visibroker ORB and must be running with the necessary IDL files loaded to allow access to a particular CORBA interface.

If you are using the Orbix ORB, objects that are to be accessed must be registered with the Orbix Naming Service. This requires that the appropriate server changes be made such that the Server carries out the correct registration process.

Objects may be registered in the Naming Service within certain contexts. For example, if you want to register one grid object in the grid.exe executable and this grid object has the human readable name gridObject1 in the server, then it is possible to register this object in the Naming Service under the context of

\Siebel Objects\Grids\gridObject1

To resolve the object denoted by the name gridObject1, navigate through the appropriate context hierarchy to get the actual Object. Following this convention, use the following to call CORBACreateObject to obtain a reference to the preceding object:

var p_corb_gridObj = CORBACreateObject("Siebel Objects:Grids:gridObject1")

Separate each of the Naming Context nodes with a colon (:). Note that Orbix ignores the second and third parameters to CORBACreateObject.

NOTE:  Siebel eScript has built-in exception support for CORBA objects. Use the try Statement and the throw Statement to build exception handlers. Orbix does not support built-in user exceptions for CORBA objects.

CORBACreateObject and any call to CORBA objects can throw CORBAObjException in addition to exceptions declared in the IDL file.

Exceptions can be caught in the eScript engine using try catch clauses. Exception objects always have a name and are accessible with name data member.

In general, if the exception occurs while executing a CORBA function, the name of the exception object is CORBAObjException. If the error occurs in Siebel code, the exception name is SiebelException.

User exceptions are not supported for Visibroker, where the exceptions declared in the IDL file are mapped to the corresponding eScript objects. The exception name is the one declared in the IDL.

For example, the user can declare a completed exception object in the IDL as follows:

exception DataException {
         string moduleId;
         string messageText;
         long schProcRtrnCd;
         long appRtrnCd;
         string addtnlText;

         ErrorCode errCode;
         string errDesc;
         string fieldName;
         long fieldOccurs;

         long fldMsgCd;
         string fldMsg;

         ExpSource expSource;

};

Whenever this exception is thrown, the eScript catch clause can access this particular object data member using this syntax:

if (obj.name == "DataException ")
{
   TheApplication().MsgBox(obj.moduleId);
   ... any other data members...

return (CancelOpertaion);
}

Example

This example instantiates a CORBA object and calls several methods on it.

var cObj = myCorbaOb.balance () ; //call a method
[check the return value...]

   myCorbaOb.SetBalance (50000); //call another method
   var acctNum = myCorbaOb.accountNumber ; // get the property value

   myCorbaOb.accountNumber = accNum ; //set it.

For more information on configuring the Siebel Client with the CORBACreateObject() Method, refer to the section on the JSECorbaConnector parameter in Siebel Web Client Administration Guide.


 Siebel eScript Language Reference 
 Published: 18 April 2003