The createObject function takes different arguments depending on the value of the type argument:
createObject('component', cfcName)
createObject('java', class)
createObject('java', class, bundleName, bundleVersion) (Lucee only)
createObject('webservice', urltowsdl, [, portname])
createObject('.NET', class, assembly [, server, port, protocol, secure])
createObject('com', class, context, serverName)
createObject(type, className)
→ returns any
component
corba
com
java
webservice
.NET
dotnet
createObject Component
<cfscript>
tellTimeCFC=createObject("component","appResources.components.tellTime");
tellTimeCFC.getLocalTime();
</cfscript>
createObject WebService
<cfscript>
ws = createObject("webservice", "http://www.xmethods.net/sd/2001/TemperatureService.wsdl");
xlatstring = ws.getTemp(zipcode = "55987");
writeOutput("The temperature at 55987 is " & xlatstring);
</cfscript>
createObject filesystem
POIFSFileSystem=createObject("java","org.apache.poi.poifs.filesystem.POIFSFileSystem","apache.poi","3.11.0");
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.