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:
Open the Components tab under the Application panel.
Choose Web Services from the dropdown box in the Components tab.
Click the plus (+) button next to the dropdown box where you selected Web Services. This opens the Add Using WSDL dialog box.
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. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access