Web services
Since its inception, the Internet has allowed people to access content stored on remote computers.
This content can be static, such as a document represented by an HTML file, or dynamic, such as
content returned from a ColdFusion page or CGI script.
Web services are a new technology that lets you access application functionality, which resides on
remote computers, that someone created and made available. With a web service, you can make a
request to the remote application to perform an action.
For example, you can request a stock quote, pass a text string to be translated, or request
information from a product catalog. The advantage of web services is that you do not have to
recreate application logic that someone else has already created and, therefore, you can build your
applications faster.
Referencing a remote web service within your ColdFusion application is called consuming web
services. Since web services adhere to a standard interface regardless of implementation
technology, you can consume a web service implemented as part of a ColdFusion application, or
as part of a .NET or Java application.
You can also create your own web services and make them available to others for remote access,
called publishing web service. Applications that consume your web service can be implemented in
ColdFusion MX or by any application that recognizes the web service standard.
Accessing a web service
In its simplest form, an access to a web service is similar to a function call. Instead of the function
call referencing a library on your computer, it references remote functionality over the Internet.
One feature of web services is that they are self describing. That means a person who makes a web
service available also publishes a description of the API to the web service as a Web Services
Description Language (WSDL) file.
A WSDL file is an XML-formatted document that includes information about the web service,
including the following information:
•
Operations that you can call on the web service
•
Input parameters that you pass to each operation
•
Return values from an operation
Consuming web services typically is a two-step process:
Parse the WSDL file of the web service to determine its interface.
1
A web service makes its associated WSDL file available over the Internet. You need to know the
URL of the WSDL file defining the service. For example, you can access the WSDL file for the
BabelFish web service at the following URL:
www.xmethods.net/sd/2001/BabelFishService.wsdl
For an overview of WSDL syntax, see
Make a request to the web service.
2
The following example invokes an operation on the BabelFish web service to translate the
string "Hello World" from English into Spanish:
<cfinvoke
webservice='http://www.xmethods.net/sd/2001/BabelFishService.wsdl'
method='BabelFish'
708
Chapter 32: Using Web Services
"Working with WSDL files" on page 710
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers