Whatever message this page gives is out now! Go check it out!
| ColdFusion data type | WSDL data type |
|---|---|
| numeric | SOAP-ENC:double |
| Boolean | SOAP-ENC:boolean |
| string | SOAP-ENC:string |
| array | SOAP-ENC:Array |
| numeric | SOAP-ENC:float |
| binary | xsd:base64Binary |
| date | xsd:dateTime |
| void (operation returns nothing) | |
| structure | complex type |
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>Employee data type definition includes six elements, the data type of each element, and the name of each element.Employee data type. This message defines an input parameter, as the following code shows:<part name="thestruct" type="s0:Employee" />
</message>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:<input message="s0:updateEmployeeInfoSoapIn" />
</operation>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:<cfscript>
stUser = structNew();
stUser.active = TRUE;
stUser.fname = "John";
stUser.lname = "Smith";
stUser.age = 23;
stUser.hiredate = createDate(2002,02,22);
stUser.number = 123.321;
ws = createObject("webservice", "http://somehost/EmployeeInfo.asmx?wsdl");
ws.updateEmployeeInfo(stUser);
</cfscript>Employee to define an input parameter to an operation. A WSDL file can also define a return value using the Employee type, as the following code shows:<part name="updateEmployeeInfoResult" type="s0:Employee" />
</message>
<operation name="updateEmployeeInfo">
<input message="s0:updateEmployeeInfoSoapIn" />
<output message="s0:updateEmployeeInfoSoapOut" />
</operation>updateEmployeeInfo takes a complex type as input and returns a complex type as output. To handle the input parameter, you create a structure. To handle the returned value, you write it to a ColdFusion variable, as the following example shows:<!--- Write the returned value to a ColdFusion variable. --->
<cfscript>
stUser = structNew();
stUser.active = TRUE;
stUser.fname = "John";
stUser.lname = "Smith";
stUser.age = 23;
stUser.hiredate = createDate(2002,02,22);
stUser.number = 123.321;
ws = createObject("webservice", "http://somehost/echosimple.asmx?wsdl");
myReturnVar = ws.echoStruct(stUser);
</cfscript>
<!--- Output the returned values. --->
<cfoutput>
<br>
<br>Name of employee is: #myReturnVar.fname##myReturnVar.lname#
<br>Active status: #myReturnVar.active#
<br>Age:#myReturnVar.age#
<br>Hire Date: #myReturnVar.hiredate#
<br>Favorite Number: #myReturnVar.number#
</cfoutput>myReturnVar using dot notation in the same way that you access structure fields. If a complex type has nested elements, in the way a structure can have multiple levels of nested fields, you use dot notation to access the nested elements, as in a.b.c.d, to whatever nesting level is necessary.myReturnVar is not a ColdFusion structure. It is a container for the complex type, but has none of the attributes of a ColdFusion structure. Calling the ColdFusion function isStruct on the variable returns False....
ws = createObject("webservice", "http://somehost/echosimple.asmx?wsdl");
myReturnVar = ws.echoStruct(stUser);
realStruct = structNew();
realStruct.active = #myReturnVar.active#;
realStruct.fname = "#myReturnVar.fname#";
realStruct.lname = "#myReturnVar.lname#";
realStruct.age = #myReturnVar.age#;
realStruct.hiredate = #myReturnVar.hiredate#;
realStruct.number = #myReturnVar.number#;
</cfscript>IsStruct on realStruct returns True and you can use all ColdFusion structure functions to process it.struct and query. When you publish a ColdFusion web service that uses parameters of type struct or query, the consuming application must be able to handle the data.struct and query data types in the web service publisher with the consumer. For more information, see Consuming ColdFusion web services in Consuming web services.<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>QueryBean. The QueryBean data type contains two elements, as the following excerpt from a WSDL file shows:<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>QueryBean:| Element name | Description |
|---|---|
ColumnList | String array that contains column names |
data | Two-dimensional array that contains query data |
QueryBean defines these elements as follows:<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>