Programming ColdFusion MX: Web Services | WebReference

Programming ColdFusion MX: Web Services

Programming ColdFusion MX: Web Services

A relatively new technology, web services seeks to provide a global object repository where applications can be assembled using using relatively simple protocols. Here is an overview of consuming, producing and security of web services. By Rob Brooks-Bilson.

An excerpt from the book: Programming ColdFusion MX, 2nd Edition by O'Reilly.

There's no doubt that web services are hot. It's impossible to pick up a trade publication without seeing at least half a dozen articles extolling the virtues of the web services revolution. Although still considered an immature technology, web services offer a great deal of promise in many spaces. Fully realized, the web services vision seeks to provide a global object repository where applications can be assembled from self-contained software components using relatively simple protocols and a ubiquitous transport mechanism--the Internet. In ColdFusion MX, web services are built using ColdFusion Components (CFCs).

Web services have many uses. Besides the potential to reduce the amount of code you have to write (by providing an existing web service that fits your needs), they also offer interesting possibilities for enterprise application integration, modernizing legacy applications, and providing access to data in new and interesting ways. As the idea of web services continues to evolve, so too will the ways in which they are used. For now, ColdFusion MX gives you the power to work with what's available, while at the same time maintaining the flexibility to include new pieces of the web services pie as they mature.

This chapter starts with an overview of web services. It then covers consuming web services, producing web services, and web services security.

Web Services Overview

Web services provide a new way to build loosely coupled applications from components. At a basic level, a call to a web service is similar to a remote procedure call. A client makes a request of a remote object, the object performs some action, and a response is sent back to the client. At a higher level, applications built from web services may be assembled from components local to the organization or geographically distributed across the Internet. Web services provide a framework for standardizing both the interface and transport layer for these applications. Figure 24-1 shows a basic web services architecture.

Figure 24-1. Web services architecture


Web services are really an aggregation of several technologies layered on top of common Internet protocols such as HTTP. To better understand just what web services are, as well as how they work, let's break the architecture down into its major parts. There are four main components that make up a web service:

Extensible Markup Language (XML)
XML can be considered the foundation of the web services stack. It provides a standardized platform- and language-neutral format for exchanging data among applications. More information about XML can be found at Additional information on working with XML in ColdFusion MX can be found in Chapter 22.

Web Services Description Language (WSDL)
WSDL is an XML format for describing a web service. It describes the purpose of the web service, where and how you can access it, and what functionality (methods) it exposes. We'll be discussing various parts of the WSDL throughout the chapter.

Simple Object Access Protocol (SOAP)
SOAP provides an XML-based messaging framework for web services. A SOAP message is essentially an XML document made up of an envelope containing an optional header and required body. Although not yet a W3C recommendation, Version 1.1 does have standing as a W3C note. You can read more about SOAP at You don't need to know SOAP to make use of web services in ColdFusion MX, as messaging is handled automatically by ColdFusion MX's underlying implementation of the Apache Axis SOAP engine.[1]

Universal Description, Discovery, and Integration (UDDI)
UDDI is basically a directory service for web services. It provides a standardized interface for registering and querying web service metadata. There are currently four global public UDDI directories:

  • IBM:
  • Microsoft:
  • SAP:
  • NTT Communications:
  • Besides global public directories, many specialized private directories exist. One of the most popular is XMethods ( It's also possible to set up your own private UDDI directory (say for use within your organization). A number of tools are available for doing this, including UDDI4J (

    ColdFusion MX does not support UDDI directly. However, it is possible to register web services you publish using ColdFusion MX with UDDI directories. Additionally, you can manually search UDDI directories for available web services you may wish to use.

    As ColdFusion MX has the potential to be both a consumer and a producer of web services, it's important for you to see how this all fits together. Figure 24-2 shows how ColdFusion MX fits into the web services picture.

    Figure 24-2. ColdFusion and web services


    Created: March 27, 2003
    Revised: Sept 1, 2003