Adobe COLDFUSION 9 Manual page 1121

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
ColdFusion data type
date
void (operation returns nothing)
structure
This table shows that complex data types map to ColdFusion structures. ColdFusion structures offer a flexible way to
represent data. You can create structures that contain single-dimension arrays, multi-dimensional arrays, and other
structures.
The ColdFusion mapping of complex types to structures is not automatic. Accessing the data as a structure requires
some processing of the data. The next sections describe how to pass complex types to web services, and how to handle
complex types returned from web services.
Passing input parameters to web services as complex types
A web service can take a complex data type as input. In this situation, you can construct a ColdFusion structure that
models the complex data type, then pass the structure to the web service.
For example, the following excerpt from a WSDL file shows the definition of a complex type named Employee:
<s:complexType name="Employee">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="fname" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="lname" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="active" type="s:boolean" />
<s:element minOccurs="1" maxOccurs="1" name="age" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="hiredate" type="s:dateTime" />
<s:element minOccurs="1" maxOccurs="1" name="number" type="s:double" />
</s:sequence>
</s:complexType>
The Employee data type definition includes six elements, the data type of each element, and the name of each element.
Another excerpt from the WSDL file shows a message definition using the Employee data type. This message defines
an input parameter, as the following code shows:
<message name="updateEmployeeInfoSoapIn">
<part name="thestruct" type="s0:Employee" />
</message>
A third excerpt from the WSDL file shows the definition of an operation, named updateEmployeeInfo, possibly one
that updates the employee database with the employee information. This operation takes as input a parameter of type
Employee, as the following code shows:
<operation name="updateEmployeeInfo">
<input message="s0:updateEmployeeInfoSoapIn" />
</operation>
To call the updateEmployeeInfo operation, create a ColdFusion structure, initialize six fields of the structure that
correspond to the six elements of Employee, and then call the operation, as the following code shows:
WSDL data type
xsd:dateTime
complex type
Last updated 8/5/2010
1116

Advertisement

Table of Contents
loading

Table of Contents