- Home
- ColdFusion
- Creating a Web Service with ColdFusion: the Basics
Creating a Web Service with ColdFusion: the Basics
- By Samee Jhor
- Published 01/2/2007
- ColdFusion
- Unrated
Samee Jhor
View all articles by Samee Jhor
Basic Requirements
Installing ColdFusion on Windows Platform
This tutorial is based on programs developed on a Windows XP Professional machine which has IIS 5.1 installed on it. Since this tutorial deals with creating a web service with ColdFusion, it is assumed that Cold Fusion MX Server software is installed. If you need to know how to install Cold Fusion MX.
What is a web service?
A web service is a software related technology that facilitates machine-to-machine interaction over a network. The WSDL (Web Services Discovery Language) format is supposed to be understood and processed by all the machines. The WSDL therefore sets up the rules of engagement for this interaction. These rules are enforced by sending the messages to be carried by SOAP (Simple Objects Access Protocol) envelopes. The envelopes are carried and delivered by such all too well known protocols as HTTP, SMTP and others. The language used between machines for interaction will be the now familiar, text format based, XML (eXtensible Markup Language).
A web service, because of its open source origin, should be transparent to the diverse, existing programs and operating systems in its ideal embodiment. The web service when it is ready may be published in what is called a UDDI (Universal Description Discovery Integration) registry, a repository akin to the telephone directory of companies. UDDI is again an open source standard agreed to universally. The best place to learn more about these various acronyms is W3C.
Virtual Directories on the IIS
Virtual directories are those directories that are accessed by Internet/intranet users, normally seen in the URL address of the page being browsed. However, the actual files are located somewhere on the machine, more often in the root directory of the host. This way those who arrive at the web page will not actually know where the related file is kept. The web service related files are placed in a Virtual Directory called CF_WebSvc, and the Web client related files consuming this service are placed in another virtual directory called TestingCF as shown in Fig.1. The actual files are kept on the machine at the indicated physical locations.

CF_webSvc----------- C:\Documents and Settings\computer user\
My Documents\ColdFusionWebSvc
TestingCF----------- C:\Documents and Settings\computer user\
My Documents\MyCFusion
ColdFusion background for Web Service
If you have been developing custom functions and ColdFusion components you are already well on your way to creating a web service. This tutorial assumes that you are starting at the very beginning.
ColdFusion components are almost OOP based but not totally; they have methods and constructs, and they provide reusable code. We will look at it in more detail during this tutorial. However, if you know what functions achieve in any programming language, you are not far from understanding components. They turn functions into objects whose methods can be accessed. ColdFusion function methods morph themselves into ColdFusion Web Service methods via CFC.
If you have read my previous article, you would know that ColdFusion code can be written in two ways: tag based and script based with ColdFusion specific <cfscript/>. You need to know a number of function-specific tags and CFC related tags, such as the following:
cffunction [argument list] cfargument cfreturn cfcomponent
Spread The Word
Article Series
-
Creating a Web Service with ColdFusion: the Basics

