Consuming web services
ColdFusion MX provides two methods for consuming web services. The method that you choose
depends on your ColdFusion programming style and application.
The following table describes these methods:
Method
CFML operator
CFScript
CreateObject()
CFML tag
cfinvoke
One important consideration is that all consumption methods use the same underlying
technology and offer the same performance.
Note: In ColdFusion MX and ColdFusion MX 6.1, if a WSDL file specifies multiple web services, you
can use only the first web service that is defined in the file. To access any other service, copy the file
and separate it into individual WSDL files for each service you use.
About the examples in this section
The examples in this section reference the BabelFish web service from AltaVista. BabelFish can
translate strings up to 5K in length from one language to another. You can read the WSDL file for
this web service in
If you add the BabelFish web service in Dreamweaver MX, you see the following description of it
in the Application panel.
For information on adding a web service in Dreamweaver, see
Dreamweaver MX" on page
http://babelfish.altavista.com/.
Passing parameters to a web service
One type of information in the WSDL file defines the web service operations and the input and
output parameters of each operation, including the data type of each parameter. If you register the
web service in Dreamweaver MX, as shown in the previous section, you see that the data type of
both input parameters is string.
The following example shows a portion of the WSDL file for the BabelFish web service:
<message name="BabelFishRequest">
<part name="translationmode" type="xsd:string" />
<part name="sourcedata" type="xsd:string" />
</message>
Description
Consumes a web service from within a CFScript block
Consumes a web service from within a block of CFML code
"Reading a WSDL file" on page
711. For more information on BabelFish, see
711.
"Viewing a WSDL file using
Consuming web services
713
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?