When consuming a web service with ColdFusion (any web service, not just those written in ColdFusion), you can use the cfinvoke tag. To do this you must supply the following information as attributes:
Use a cfinvoke tag with the following attributes:
After the cfinvoke tag, display the data returned using the cfoutput tag and the variable name:
<cfoutput> #variables.returnedText# </cfoutput>
<cfinvoke webservice="http://127.0.0.1:8500/devnet/ws/Simple.cfc?wsdl" method="firstws" returnvariable="returnedText"> </cfinvoke> <cfoutput> #variables.returnedText# </cfoutput>
In the same file, use another cfinvoke tag with the following attributes to get the query data that the web service returned:
Display the returned query using the cfdump tag:
<cfdump var="#returnedQuery#">
Save the document and browse it. In addition to the text, you should output a dump of the query, part of which is shown here:
Figure 4. The cfdump tag output from the query
Note: If you are using Dreamweaver to build your files, and the cfdump tag does not generate output that appears as above, remove the <!DOCTYPE …> tag and the cfdump tag information will display.