Whatever message this page gives is out now! Go check it out!

Invoke

Last update:
May 18, 2026
Note:
As of ColdFusion (2021 release), CORBA has been removed. You can no longer use CORBA-related features, functions, and tags.

Description

Does either of the following:
  • Invokes a component method from within a ColdFusion page or component
  • Invokes a method on an instantiated web service object
  • invokes a method on Java/.NET/COM/Corba object

Returns

Returns what is returned by the invoked method.

History

ColdFusion 10: Added this function

Syntax

invoke(instance, methodname [, arguments])

Properties

Parameter
Description
instance
Required.
For CFC : String or component object; a reference to a component, or component name/path to instantiate. Can be an empty string when invoking a method within the same ColdFusion page or component.
For webservice/Java/.NET/COM/Corba : object instance
methodname
Required. Name of a method. For a web service, the name of an operation.
arguments
Optional. Arguments to pass to the method.

Example

Invoke a method on Component
<cfscript> 
obj = createObject("component","TestComponent"); 
invoke(obj,"function1",{a1="ColdFusion"}); 
</cfscript>
Invoke methods on a webservice
<cfscript> 
obj = createObject("webservice","http://somedomain/test.cfc?wsdl"); 
//Invoke foo 
result = invoke(obj,"foo",{arg1="ColdFusion"}); 

//Invoke bar with two arguments, passing the second argument as null.
result = invoke(obj, "bar", {arg1="ColdFusion", arg2=javacast("null", "")});
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page