CreateObject: web service object

Description

This function can create a web service object.

Returns

A web service object.

Function syntax

CreateObject(type, urltowsdl[, portname, wsdl2JavaArgs])  
 
OR 
 
CreateObject(type, urltowsdl, argStruct) 

Parameters

Parameter

Description

type

Type of object to create.

  • com

  • corba

  • java

  • component

  • webservice

urltowsdl

Specifies the URL to web service WSDL file. One of the following:

  • The absolute URL of the web service

  • The Name (string) assigned in the ColdFusion Administrator to the 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.

wsdl2JavaArgs

A string containing a space-delimited list of arguments to pass to the WSDL2Java tool that generates Java stubs for the web services. Useful arguments include the following:

  • -W or --noWrapped: Turns off the special treatment of wrapped document/literal style operations.

  • -a or --all: Generates code for all elements in the WSDL, even unreferenced ones.

  • -w or --wrapArrays: Prefers building beans to straight arrays for wrapped XML array types. This switch is not in included in the Axis documentation.

For detailed information on valid arguments, see the Apache Axis WSDL2Java Reference.

argStruct

A structure containing web service configuration arguments. For more information see Usage

Usage

You can use the CreateObject function to create a web service.

The argStruct structure can contain any combination of the following values:

Name

Default

Description

password

Password set in the Administrator, if any

The password to use to access the web service. If the webservice attribute specifies a web service name configured in the Administrator, overrides any user name specified in the Administrator entry.

port

 

See portname in the Syntax Parameter table.

proxyPassword

http.proxyPassword system property, if any

The user’s password on the proxy server.

proxyPort

http.proxyPort system property, if any

The port to use on the proxy server.

proxyServer

http.proxyHost system property, if any

The proxy server required to access the webservice URL.

proxyUser

http.proxyUser system property, if any

The user ID to send to the proxy server.

refreshWSDL

no

  • yes: Reload the WSDL file and regenerate the artifacts used to consume the web service

  • no

saveJava

no

  • yes: Save the Java generated by the WSDL2Java converter that generates Java web service stubs. This code can be useful in debugging errors.

  • no

timeout

0 (no time-out)

The time-out for retrieving the web service WSDL, in seconds.

username

User name set in the Administrator, if any

The user name to use to access the web service. If the webservice attribute specifies a web service name configured in the Administrator, overrides any user name specified in the Administrator entry.

wsdl2javaArgs

 

See the Syntax parameter table.

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>