The two ColdFusion data types that do not map exactly to WSDL data types are struct and query. When you publish a ColdFusion web service that uses parameters of type struct or query, the consuming application needs to be able to handle the data.
A ColdFusion structure can hold an unlimited number of key-value pairs where the values can be of any ColdFusion data type. While it is a very useful and powerful way to represent data, it cannot be directly mapped to any XML data types defined in the SOAP 1.1 encoding and XML Schema specification. Therefore, ColdFusion structures are treated as a custom type and the complex type XML schema in WSDL looks like the following:
<complexType name="mapItem"> <sequence> <element name="key" nillable="true" type="xsd:anyType"/> <element name="value" nillable="true" type="xsd:anyType"/> </sequence> </complexType> <complexType name="Map"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/> </sequence> </complexType>
This complex type defines a representation of a structure, where the structure keys and values can be any type.
In the WSDL mapping of a ColdFusion structure, each key-value pair in the structure points to the next element in the structure except for the final field, which contains a value. Use dot notation to access the key-value pairs.
ColdFusion publishes query data types as the WSDL type QueryBean. The QueryBean data type contains two elements, as the following excerpt from a WSDL file shows:
<complexType name="QueryBean"> <all> <element name="data" nillable="true" type="intf:ArrayOf_SOAP-ENC_Array" /> <element name="ColumnList" nillable="true" type="intf:ArrayOf_SOAP-ENC_string" /> </all> </complexType>
The following table describes the elements of QueryBean:
Element name |
Description |
---|---|
ColumnList |
String array that contains column names |
data |
Two-dimensional array that contains query data |
The WSDL file for a QueryBean defines these elements as follows:
<complexType name="ArrayOf_SOAP-ENC_Array"> <complexContent> <restriction base="SOAP-ENC:Array"> <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="SOAP-ENC:Array[]" /> </restriction> </complexContent> </complexType> <complexType name="ArrayOf_SOAP-ENC_string"> <complexContent> <restriction base="SOAP-ENC:Array"> <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]" /> </restriction> </complexContent> </complexType>