Adobe ColdFusion 8

Using CORBA interface methods in ColdFusion

When you use the cfobject tag or the CreateObject function to create a CORBA object, ColdFusion creates a handle to a CORBA interface, which is identified by the cfobject name attribute or the CreateObject function return variable. For example, the following CFML creates a handle named myHandle:

<cfobject action = "create" type = "CORBA" context = "IOR" 
    class = "d:\temp\tester.ior" name = "myHandle" locale="visibroker">
<cfset myHandle = CreateObject("CORBA", "d:\temp\tester.ior", "IOR", "visibroker")

You use the handle name to invoke all of the interface methods, as in the following CFML:

<cfset ret=myHandle.method(foo)>

The following sections describe how to call CORBA methods correctly in ColdFusion.

Method name case considerations

Method names in IDL are case-sensitive. However, ColdFusion is case-insensitive. Therefore, do not use methods that differ only in case in IDL.

For example, the following IDL method declarations correspond to two different methods:

testCall(in string a); // method #1
TestCall(in string a); // method #2

However, ColdFusion cannot differentiate between the two methods. If you call either method, you cannot be sure which of the two will be invoked.

Passing parameters by value (in parameters)

CORBA in parameters are always passed by value. When calling a CORBA method with a variable in ColdFusion, specify the variable name without quotation marks, as shown in the following example:

IDL

void method(in string a);

CFML

<cfset foo="my string">

<cfset ret=handle.method(foo)>

Passing variables by reference (out and inout parameters)

CORBA out and inout parameters are always passed by reference. As a result, if the CORBA object modifies the value of the variable that you pass when you invoke the method, your ColdFusion page gets the modified value.

To pass a parameter by reference in ColdFusion, specify the variable name in double-quotation marks in the CORBA method. The following example shows an IDL line that defines a method with a string variable, b, that is passed in and out of the method by reference. It also shows CFML that calls this method.

IDL

void method(in string a, inout string b);

CFML

<cfset foo = "My Initial String">

<cfset ret=handle.method(bar, "foo")>

<cfoutput>#foo#</cfoutput>

In this case, the ColdFusion variable foo corresponds to the inout parameter b. When the CFML executes, the following happens:

  1. ColdFusion calls the method, passing it the variable by reference.
  2. The CORBA method replaces the value passed in, "My Initial String", with some other value. Because the variable was passed by reference, this modifies the value of the ColdFusion variable.
  3. The cfoutput tag prints the new value of the foo variable.

Using methods with return values

Use CORBA methods that return values as you would any ColdFusion function; for example:

IDL

double method(out double a);

CFML

<cfset foo=3.1415>

<cfset ret=handle.method("foo")>

<cfoutput>#ret#</cfoutput>