Creating a Web Service with ColdFusion: the Basics
A web service is a software related technology that facilitates machine-to-machine interaction over a network. Web services are used by clients who access the service, and could be written in any programming language. This article will show you how to create a web service using ColdFusion.
Creating a Web Service with ColdFusion: the Basics - Create a Function (Page 2 of 4 )
Create function justFunction.cfm
I will show how to create a function. Of course you need to know all those tags. But this next code shows a very simple function which outputs a string after accepting a different string. This file is called justFunction.cfm. The function is called by its name. The argument is sent through the vehicle "arguments. name" which is "Jay" in this case.
<cffunction name="WelcomeMsg" returntype="string">
<cfargument name="name" type="string" required="yes">
<cfreturn "<h3><font color='blue'>Welcome to my Web Service Site</font>
</h3> " & arguments. name &"! " & "What would you like to do?">
</cffunction>
<cfoutput>
#WelcomeMsg("Jay")#
</cfoutput>
justFunction.cfm display
You need to place this file into the TestingCF virtual directory (which means in the physical directory shown earlier). Now if you browse this file in your favorite browser, this is what you will see.