User Guide

534 Chapter 3: ColdFusion Functions
CreateObject: web service object
Description
This function can create a web service object.
Returns
A web service object.
Function syntax
CreateObject(type, urltowsdl [, portname ])
Parameters
Usage
You can use the CreateObject function to create a web service.
Example
<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>
Parameter Description
type Type of object to create.
com
corba
java
component
webservice
urltowsdl WSDL file URL; location of web service
portname 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.