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.
Содержание ColdFusion MX
Страница 1: ...Developing ColdFusion MX Applications...
Страница 22: ...22 Contents...
Страница 38: ......
Страница 52: ...52 Chapter 2 Elements of CFML...
Страница 162: ......
Страница 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Страница 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Страница 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Страница 266: ......
Страница 314: ...314 Chapter 14 Handling Errors...
Страница 344: ...344 Chapter 15 Using Persistent Data and Locking...
Страница 349: ...About user security 349...
Страница 357: ...Security scenarios 357...
Страница 370: ...370 Chapter 16 Securing Applications...
Страница 388: ...388 Chapter 17 Developing Globalized Applications...
Страница 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Страница 410: ......
Страница 426: ...426 Chapter 19 Introduction to Databases and SQL...
Страница 476: ...476 Chapter 22 Using Query of Queries...
Страница 534: ...534 Chapter 24 Building a Search Interface...
Страница 556: ...556 Chapter 25 Using Verity Search Expressions...
Страница 558: ......
Страница 582: ...582 Chapter 26 Retrieving and Formatting Data...
Страница 668: ......
Страница 734: ...734 Chapter 32 Using Web Services...
Страница 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Страница 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Страница 788: ......
Страница 806: ...806 Chapter 35 Sending and Receiving E Mail...