22.08.2013 Views

ColdFusion Developer's Guide

ColdFusion Developer's Guide

ColdFusion Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta<br />

Referencing a remote web service within your <strong>ColdFusion</strong> application is called consuming web<br />

services. Since web services adhere to a standard interface regardless of implementation<br />

technology, you can consume a web service implemented as part of a <strong>ColdFusion</strong> application,<br />

or as part of a .NET or Java application.<br />

You can also create your own web services and make them available to others for remote<br />

access, called publishing web service. Applications that consume your web service can be<br />

implemented in <strong>ColdFusion</strong> or by any application that recognizes the web service standard.<br />

Accessing a web service<br />

In its simplest form, an access to a web service is similar to a function call. Instead of the<br />

function call referencing a library on your computer, it references remote functionality over<br />

the Internet.<br />

One feature of web services is that they are self-describing. That means a person who makes a<br />

web service available also publishes a description of the API to the web service as a Web<br />

Services Description Language (WSDL) file.<br />

A WSDL file is an XML-formatted document that includes information about the web<br />

service, including the following information:<br />

■ Operations that you can call on the web service<br />

■ Input parameters that you pass to each operation<br />

■ Return values from an operation<br />

Consuming web services typically is a two-step process:<br />

1. Parse the WSDL file of the web service to determine its interface.<br />

A web service makes its associated WSDL file available over the Internet. You must know<br />

the URL of the WSDL file defining the service. For example, you can access the WSDL<br />

file for the TemperatureService web service at the following URL:<br />

www.xmethods.net/sd/2001/TemperatureService.wsdl<br />

For an overview of WSDL syntax, see “Working with WSDL files” on page 1294<br />

2. Make a request to the web service.<br />

The following example invokes an operation on the Temperature web service to retrieve<br />

the temperature in zip code 55987:<br />

<br />

<br />

1292 Using Web Services

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!