O'Reilly logo

Programming ColdFusion MX, 2nd Edition by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Consuming Web Services

When a client makes a request to a web service, it is said to be a consumer of that service. ColdFusion MX makes consuming web services simple. There are three ways to consume a web service in ColdFusion MX. You can use the cfinvoke tag, the cfobject tag, or the createObject( ) function. It’s also possible to use the cfhttp tag to manually consume a web service. Because of the complexity involved with that method, I’m going to limit my coverage to the first three methods.

In many cases, you don’t need to know anything about the web service you want to consume other than the URL of its WSDL file. This is especially true if you use Dreamweaver MX to develop your ColdFusion MX applications. Generating the necessary CFML code to consume a web service using Dreamweaver MX is literally a point and click process:

  1. Open the Components tab under the Application panel.

  2. Choose Web Services from the dropdown box in the Components tab.

  3. Click the plus (+) button next to the dropdown box where you selected Web Services. This opens the Add Using WSDL dialog box.

  4. Enter the URL to the desired WSDL file and click OK.

Dreamweaver MX automatically generates a proxy for the web service and makes it available in the Components tab. From here, you can expand the proxy to show the web service’s fields, methods, and properties as defined by the WSDL file.

If you don’t use Dreamweaver MX, that’s okay too. You can visually inspect a WSDL file by entering its URL into your web browser. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required