| 1 |
Open the page that you want to add the web service to. The page you create must be a dynamic page using ColdFusion MX. |
| 2 |
Choose Window > Server Components to open the Server Components panel. |
| 3 |
In the Server Components panel, choose Web Services from the pop-up menu in the upper left of the panel, click the plus (+) button, and select Add Using WSDL. |
| 4 |
Specify the URL of the WSDL file you want to use. |
|
If you know the URL of the WSDL file, enter it in the URL of the WSDL text box.
 |
|
If you don't know the URL of the WSDL file, you can browse a directory of web services. When you find the web service you want, copy and paste the URL of the web service into the WSDL edit box. To launch a web browser, click the UDDI browse button (the Globe icon) and select one of the listed web service registries. Dreamweaver will launch the browser and open the selected registry. Locate the web service you want to use, and copy the URL of its WSDL file to the Clipboard (Ctrl+C). Return to the Web Services Chooser and paste the URL into the dialog box. |
| 5 |
Ensure that the Proxy Generator pop-up menu is set to ColdFusion MX. |
|
ColdFusion MX provides a built-in proxy generator. Other server technologies often require that you install and configure a proxy generator local to Dreamweaver MX (for example, the ASP.NET SDK). |
| 6 |
Click OK. |
|
The proxy generator creates a proxy for the web service and introspects it. |
|
The proxy (also known as an abstraction class) contains the fields, methods, and properties of the web service, and makes them available to the locally hosted page. When you generate a proxy for your page, Dreamweaver lets you view them in the Components panel by introspecting the proxy. Introspection is the process of querying the internal structure of the web service proxy, and making its interfaces, methods, and properties available through Dreamweaver MX. |
|
The web service is now available for use in the page. The web service and its available methods appear in the Server Components panel.
 |
| 7 |
In the Document window, in Code view, drag the method you want to use into the page's code. |
|
Dreamweaver MX adds the method and dummy parameters to the page. |
| 8 |
Edit the inserted code with appropriate service instance names, data types, and parameter values, as required by the web service. The web service's author should provide descriptions of the necessary data types and parameter values. |
|
In the ColdFusion MX example shown below, the web service is enclosed by the <cfinvoke> tags. When developing a web service in ColdFusion, you must use <cfinvoke> to instantiate the web service and invoke its methods. |
|
<html>
<head>
<title>Web Service</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<cfinvoke
webservice="http://velcro-qa-7:8100/helloworld/HelloWorld.cfc?wsdl"
method="sayHello"
returnvariable="aString">
</cfinvoke>
</body>
</html>
|
| 9 |
If you want to bind a return value to a visual element, switch to Design view and place a visual element on the page that can accept a data binding. Then switch back to Code view and enter the appropriate code to bind the returned value to the visual element. When creating web services, refer to the technology provider's documentation for the proper syntax with which to both instantiate the service and display the returned values to the page. |
|
In this example, the value returned for the variable aString is output using the ColdFusion <cfoutput> tag. This will display the sentence " The web service says: Hello world! " to the page. |
|
<html>
<head>
<title>Web Service</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<cfinvoke
webservice="http://velcro-qa-7:8100/helloworld/HelloWorld.cfc?wsdl"
method="sayHello"
returnvariable="aString">
</cfinvoke>
The web service says: <cfoutput>#aString#</cfoutput>
</body>
</html>
|
| 10 |
Test your page using the Dreamweaver MX Preview in Browser option (File > Preview in Browser). |
| 11 |
When you deploy web pages to a production server, Dreamweaver automatically copies the pages, the proxy, and any necessary software libraries to the web server. |
|
Note: If you develop the application with a proxy that is installed on a separate computer from the one where you developed the pages, or if you use a site management tool that does not copy all of the related files to the server, you must make certain to deploy both the proxy and any dependant library files.Otherwise, your pages cannot communicate with the web service application. |
 |
|