beautypg.com

Add a web service to a page – Adobe Dreamweaver CS3 User Manual

Page 595

background image

DREAMWEAVER CS3

User Guide

588

3

Complete the UDDI Sites dialog box, and click Done.

To add a new site, or modify an existing one, click the New or Edit button. Enter the name and URL of a UDDI
website, and click OK.

To remove an existing site, select it from the list, and click the Remove button.

Add a web service to a page

After selecting a web service, generating its proxy, and adding it to the Components panel, you insert it in a page.

The following example shows the Components panel with the web service proxy

Helloworld

added. The

Helloworld

proxy provides one method,

sayHello

, which prints “Hello World.”

The following example instantiates the

HelloWorld

web service using ColdFusion.

1

In the Document window, in Code view, drag the

sayHello

method into the page’s HTML.

Dreamweaver adds the method and dummy parameters to the page.

2

Edit the inserted code with appropriate service instance names, data types, and parameter values, as required by

the web service. The web service provides descriptions of the data types and parameter values.

In the following ColdFusion example, the web service is enclosed by the

tags. When developing a web

service in ColdFusion, use

to instantiate the web service and invoke its methods.

Web Service

webservice="http://www.mysite.com:8500:8500/helloworld/HelloWorld.cfc?wsdl"

method="sayHello"

returnvariable="aString">

3

To bind a return value to a visual element, switch to Design view and place a visual element on the page that can

accept 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

tag. This

displays the sentence “

The web service says: Hello world!

” to the page.

September 4, 2007