Home arrow ColdFusion arrow Creating a Web Service with ColdFusion: the Basics
COLDFUSION

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.

Author Info:
By: Jayaram Krishnaswamy
Rating: 5 stars5 stars5 stars5 stars5 stars / 36
February 21, 2006
TABLE OF CONTENTS:
  1. · Creating a Web Service with ColdFusion: the Basics
  2. · Create a Function
  3. · Turn the function into a Web Service
  4. · Consuming the Service

print this article
SEARCH DEVARTICLES

Creating a Web Service with ColdFusion: the Basics
(Page 1 of 4 )

Introduction

Before you start creating a web service of any form you should know some basic facts about SOAP, WSDL, XML, and UDDI. Since the web service you may create will reside on a web server before it is made public, you also need to know a few things about web servers. Web services are consumed (used) by clients who access the service. The client software ideally could be written in any programming language, .NET, Java, ColdFusion, Perl, and so on.

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, please read my article on installing CF MX 6.1, which appeared on DevArticles.com. The more recent version, CF MX 7.0 should also be installed along the same lines.

 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. You may get a bird's eye view with my other tutorial on ASPFree.com.

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


blog comments powered by Disqus
COLDFUSION ARTICLES

- Adobe ColdFusion Just Got More RAD
- How to Access a SQL Anywhere Database with C...
- CFXML: Probing XMLDOM in ColdFusion
- Creating a Web Service with ColdFusion: the ...
- CFAjax: What it is and How to Use it
- Querying SQL 2000 Server from ColdFusion
- Introduction to ColdFusion Markup Language, ...
- Introduction to ColdFusion Markup Language
- Databases and Dreamweaver MX 2004, concluded
- Databases and Dreamweaver MX 2004
- Welcome to Coldfusion MX 6.1, concluded
- Welcome to Coldfusion MX 6.1
- What You Must Know About ColdFusion Flow-Con...
- What You Must Know About Operators in ColdFu...
- Everything You Must Know About ColdFusion Va...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials