After selecting a web service, generating its proxy, and adding it to the Components panel, you can insert it into a page.
The illustration below 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. To learn more about creating a web services, and to see additional examples using .NET and JSP, visit the Macromedia Support Center at: www.macromedia.com/go/creating_web_services.
sayHello
method into the pages HTML.
Dreamweaver adds the method and dummy parameters to the page.
In the ColdFusion example shown below, the web service is enclosed by the <cfinvoke>
tags. When developing a web service in ColdFusion, 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> <cfinvoke webservice="http://www.mysite.com:8500:8500/helloworld/HelloWorld.cfc?wsdl" method="sayHello" returnvariable="aString"> </cfinvoke> </body> </html>
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://www.mysite.com:8500/helloworld/HelloWorld.cfc?wsdl" method="sayHello" returnvariable="aString"> </cfinvoke> The web service says: <cfoutput>#aString#</cfoutput> </body> </html>
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 be sure to deploy both the proxy and any dependent library files.Otherwise, your pages cannot communicate with the web service application. |