764
Chapter 34: Integrating COM and CORBA Objects in CFML Applications
Calling methods
Object methods usually take zero or more arguments. You send In arguments, whose values are
not returned to the caller by value. You send Out and In,Out arguments, whose values are
returned to the caller, by reference. Arguments sent by reference usually have their value changed
by the object. Some methods have return values, while others might not.
Use the following techniques to call methods:
•
If the method has no arguments, follow the method name with empty parentheses, as in the
following
cfset
tag:
<cfset retVal = obj.Method1()>
•
If the method has one or more arguments, put the arguments in parentheses, separated by
commas, as in the following example, which has one integer argument and one string
argument:
<cfset x = 23>
<cfset retVal = obj.Method1(x, "a string literal")>
•
If the method has reference (Out or In,Out) arguments, use double quotation marks (")
around the name of the variable you are using for these arguments, as shown for the variable x
in the following example:
<cfset x = 23>
<cfset retVal = obj.Method2("x", "a string literal")>
<cfoutput> #x#</cfoutput>
In this example, if the object changes the value of x, it now contains a value other than 23.
Calling nested objects
ColdFusion supports nested (scoped) object calls. For example, if an object method returns
another object, and you must invoke a property or method on that object, you can use the syntax
in either of the following examples:
<cfset prop = myObj.X.Property>
or
<cfset objX = myObj.X>
<cfset prop = objX.Property>
Getting started with COM and DCOM
ColdFusion is an automation (late-binding) COM client. As a result, the COM object must
support the IDispatch interface, and arguments for methods and properties must be standard
automation types. Because ColdFusion is a typeless language, it uses the object's type information
to correctly set up the arguments on call invocations. Any ambiguity in the object's data types can
lead to unexpected behavior.
In ColdFusion, you should only use server-side COM objects, which do not have a graphical user
interface. If your ColdFusion application invokes an object with a graphical interface in a
window, the component might appear on the web server desktop, not on the user's desktop. This
can take up ColdFusion server threads and prevent further web server requests from being
serviced.
ColdFusion can call Inproc, Local, or Remote COM objects. The attributes specified in the
cfobject
tag determine which type of object is called.
Summary of Contents for COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......