Macromedia dreamweaver 8-using dreamweaver Manual De Usuario
Adding a web service to a page
775
2.
Edit the inserted code with appropriate service instance names, data types, and parameter
values, as required by the web service. The web service should provide descriptions of the
data types and parameter values.
values, as required by the web service. The web service should provide descriptions of the
data types and parameter values.
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>
<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/
webservice="http://www.mysite.com:8500:8500/helloworld/
HelloWorld.cfc?wsdl"
method="sayHello"
returnvariable="aString">
</cfinvoke>
returnvariable="aString">
</cfinvoke>
</body>
</html>
</html>
3.
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 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.
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
<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>
<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>
</body>
</html>