Spec-Zone.ru › ColdFusion

createObject

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

  • CF4.5+
  • Lucee
  • BL 1.0.0+
  • See Also: cfobject cfinvoke

    Argument Reference

    type string
    Required

    The type of object
    Values:
    • component
    • corba
    • com
    • java
    • webservice
    • .NET
    • dotnet

    className string
    Required

    context string
    Required

    locale string
    Required

    servername string
    Required

    component_name string
    Required

    urltowsdl string
    Required

    WSDL file URL; location of web service

    portname string

    The port name for the web service. This value is case-sensitive and corresponds to the port element's name attribute under the service element. Specify this parameter if the web service contains multiple ports. If no port name is specified, ColdFusion uses the first port found in the WSDL.

    bundleName string

    Bundle where the object has to be located

    bundleVersion string

    Specific version to

    Compatibility

    ColdFusion:

    Version 4.5+ CORBA support DEPRECATED in CF11+

    Lucee:

    DEPRECATED since version 5 OSGi bundle and version ADDED in Lucee5+

    Examples
    Sample code invoking the createObject function

    Create a CFC / Component Instance

    createObject Component

    <cfscript>
     tellTimeCFC=createObject("component","appResources.components.tellTime"); 
     tellTimeCFC.getLocalTime();
     </cfscript>

    Create a SOAP WebService Instance

    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>      

    Create a java class with specified bundle and version

    createObject filesystem

    POIFSFileSystem=createObject("java","org.apache.poi.poifs.filesystem.POIFSFileSystem","apache.poi","3.11.0");

    © 2012–present Foundeo, Inc. and the CFDocs contributors.
    Licensed under the MIT License.
    ColdFusion is a trademark of Adobe Systems Incorporated.
    https://cfdocs.org/createobject

    Spec-Zone.ru

    Настройки Оффлайн Что нового Помощь О нас
    Spec-Zone .ru
    спецификации, руководства, описания, API