Comments
Matt McLarty wrote: For more info... Follow me on Twitter See our website
Cloud Computing
Conference & Expo
November 2-4, 2009 NYC
Register Today and SAVE !..

2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
In many cases, the end of the year gives you time to step back and take stock of the last 12 months. This is when many of us take a hard look at what worked and what did not, complete performance reviews, and formulate plans for the coming year. For me, it is all of those things plus a time when I u...
SYS-CON.TV
ColdFusion MX: A Web Service Example
Verify e-mail addresses at time-of-entry

From the first day the Internet was conceived, its primary goal was to allow people to access information stored on remote computers. Over the last couple of years, the technology of Web services has evolved not only to enhance accessing this information, but to share it as well.

 Web services are in action everywhere. When you see 20-minute delayed stock quotes on a Web site, or you track eBay auctions on another, you are most likely seeing Web services in action. Look a little further and you'll find Web services that can provide these functions as well as spell checking, address verification, ZIP code to city search, and even validation of e-mail addresses. In this article, you'll see how to access one of these Web services and display the results on your own Web site.

Sending e-mail responses to users is one of the most important services you can provide to a customer visiting your site. E-mail is used for sending response messages, reports, and personal messages, and almost without exception, any site that has an online form has a field for entering an e-mail address. This information is, or at least was, one of the hardest pieces of information to verify. This article will outline a very simple application of Web services that will have you verifying e-mail addresses at time-of-entry in no time.

Web Services
Four main components make up a Web service:

  • XML: eXtensible Markup Language provides a language-neutral format for exchanging information.
  • WSDL: Web Service Definition Language file in XML format that describes the Web service.
  • SOAP: XML-based messaging framework used for Web services.
  • UDDI: standardized directory service for registering and querying Web service meta data.
For this article, I will be concerned only with the URL location of a single Web service WSDL file.

WSDL
A WSDL file is an XML file with the following elements:

  • <definitions>: Root element specifying namespace definitions for the Web service.
  • <types>: Specifies data type definitions for the messages being exchanged.
  • <message>: Defines the data being exchanged (input/output).
  • <part>: Describes the content of the message being exchanged, typically used to name parameters being passed to the WSDL file.
  • <portType>: Defines the operations the Web service can be called to perform.
  • <operation>: Function or operation that can be performed with the Web service.
  • <input>: Input parameters for the parent <operation>.
  • <output>: Output parameters for the parent <operation>.
  • <fault>: Message returned to the parent <operation> in the event of an error.
  • <binding>: Protocol for accessing the operation described in the <portType>.
  • <service>: Related port definitions.
  • <documentation>: Information about the Web service operations.
  • <port>: Endpoint definition for a <binding> element.
ColdFusion MX has incorporated three ways to access these WSDL files (referred to as "consuming a Web service"): the <CFINVOKE> tag, the <CFOBJECT> tag, and the createObject() function. This article will focus on using the <CFINVOKE> tag. Dreamweaver MX also has a components panel (see Image I) where you can access various Web services, view tree diagrams of the WSDL files, and create code snippets by drag and drop.

Since there are numerous documents describing how to add a Web service to the component panel, this article will provide WSDL output file information directly from the Web service.

<CFINVOKE>
The <CFINVOKE> tag provides access to a registered WSDL component on a server. This WSDL component can be written as a ColdFusion Component (CFC), ASP.NET, SOAP, or in other languages that are capable of outputting a WSDL file.

The first attribute of the <CFINVOKE> tag to be populated is WEBSERVICE. The value of this attribute is the literal URL of the WSDL file for the Web service component being "consumed." For this example, the Web service is located at: http://soap.einsteinware.com/email/emailservices.asmx?WSDL.

The next <CFINVOKE> attribute that will be populated is METHOD. The value of METHOD will correspond to the <part> element used for processing the request in the WSDL file. Image II shows that the <part> element is located in the s:element element and has an attribute of "ValidateEmailAddress". The "ValidateEmailAddress" will be the value entered for METHOD.

The last attribute that will be populated for this example is the RETURNVARIABLE. This attribute specifies the name of the ColdFusion variable that will be populated with the result set returned from the Web service. Image III shows that the WSDL return values are located in the simpleType element named "CheckEmailResult". The sub-element s:restriction specifies that the result set will be a string and the s:enumeration sub-elements show five possible results.

The possible values that can be returned are:

  • Valid
  • InvalidUser
  • InvalidAddress
  • InvalidServer
  • Error
<CFINVOKEARGUMENT>
In some cases, as with the example shown, the Web service may require parameters to be supplied. Viewing the http://soap.einsteinware.com/email/emailservices.asmx?WSDL file shows that the <part> element named "ValidateEmailAddress" has a sub-element complexType.sequence.element with a name attribute of "emailAddress" with a type of string. This is the parameter for the e-mail address that's to be verified.

When parameters are required to be passed to the Web service you can use the <CFINVOKEARGUMENT> tag. This tag has two attributes: "NAME" and "VALUE".

The "NAME" attribute, for this example, is populated with the name attribute value from the complexType.sequence.element element - "emailAddress".

The "VALUE" attribute is populated with the e-mail address to be verified.

You now have code that will "consume" a Web service located on the Einstein Technologies server that you can pass an e-mail address, and verify if the e-mail address:

  • Is properly formatted
  • Has a valid server
  • Has a matching valid user on that server

<cfinvoke
webservice="http://soap.einsteinware.com/email/emailservice.asmx?WSDL"
method="ValidateEmailAddress"
returnvariable="aGetXMLValidEmail">

<cfinvokeargument name="emailAddress" value="#Trim(form.formEmailAddress)#"/>
</cfinvoke>

Now that you have the code for the <CFINVOKE> tag completed, the next step is adding code for getting the e-mail address (see Image IV for screen print) that will be sent as the emailAddress parameter. The code used in this example is shown below:

<hr />
<h1>E-Mail Verification Form<h1>
<hr />
<form name="formEmailSubmit" action="#CGI.SCRIPT_NAME#" method="post">
Enter E-Mail Address:
<input type="text" value="" name="formEmailAddress" maxlength="254" width="50">
<input type="submit" name="formSubmit" value="Verify">
</form>

About Richard Gorremans
For the past four yers, Richard Gorremans has been working for EDFUND, the nonprofit side of the Student aid Commission, located in Rancho Cordova, California. A senior software engineer with over 13 years in the business, he has been working as a technical lead producing Web-based products tht enable borrowers, lenders, and schools to view and maintain student loan information via the Web.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Why is SOA in the title of this article? There's no reference to any architecture at all. Only language-specific web service basic invocation.

ColdFusion MX: An SOA Web Services Example. From the first day the Internet was conceived, its primary goal was to allow people to access information stored on remote computers. Over the last couple of years, the technology of Web services has evolved not only to enhance accessing this information, but to share it as well.

ColdFusion MX: An SOA Web Services Example. From the first day the Internet was conceived, its primary goal was to allow people to access information stored on remote computers. Over the last couple of years, the technology of Web services has evolved not only to enhance accessing this information, but to share it as well.

ColdFusion MX: An SOA Web Services Example. From the first day the Internet was conceived, its primary goal was to allow people to access information stored on remote computers. Over the last couple of years, the technology of Web services has evolved not only to enhance accessing this information, but to share it as well.

ColdFusion MX: An SOA Web Services Example
From the first day the Internet was conceived, its primary goal was to allow people to access information stored on remote computers. Over the last couple of years, the technology of Web services has evolved not only to enhance accessing this information, but to share it as well.


Your Feedback
Luke wrote: Why is SOA in the title of this article? There's no reference to any architecture at all. Only language-specific web service basic invocation.
SOA Web Services Journal News Desk wrote: ColdFusion MX: An SOA Web Services Example. From the first day the Internet was conceived, its primary goal was to allow people to access information stored on remote computers. Over the last couple of years, the technology of Web services has evolved not only to enhance accessing this information, but to share it as well.
CFDJ News Desk wrote: ColdFusion MX: An SOA Web Services Example. From the first day the Internet was conceived, its primary goal was to allow people to access information stored on remote computers. Over the last couple of years, the technology of Web services has evolved not only to enhance accessing this information, but to share it as well.
SOA Web Services Journal News Desk wrote: ColdFusion MX: An SOA Web Services Example. From the first day the Internet was conceived, its primary goal was to allow people to access information stored on remote computers. Over the last couple of years, the technology of Web services has evolved not only to enhance accessing this information, but to share it as well.
ColdFusion Developer's Journal News Desk wrote: ColdFusion MX: An SOA Web Services Example From the first day the Internet was conceived, its primary goal was to allow people to access information stored on remote computers. Over the last couple of years, the technology of Web services has evolved not only to enhance accessing this information, but to share it as well.
SOA World Latest Stories
The federal government saved nearly $5.5 billion a year by moving to cloud services. But it might have saved up to $12 billion if cloud strategies were more aggressive, a survey of federal IT managers found. The study, drawn from interviews with 108 federal CIOs and IT managers, was ...
What do the CTOs of the CIA and the U.S. Dept. of Justice and the CIO of the National Reconnaissance Office have in common with the CEOs of Eucalyptus, GoGrid, ActiveState, Appcara, OpSource and Nortonworks, the CTOs of Rackspace, SoftLayer and AppZero, the Founder & General Manager of...
Google has reportedly figured out a way to sort of avoid looking like it’s playing favorites if the Chinese ever decide to let it take over Motorola Mobility. With Jelly Bean, the next version of Android, the Wall Street Journal says it’s changed its strategy. Rather than work with j...
SilkRoad Technology, the aptly named competitor of, say, the up-and-coming Workday that peddles cloud-based social talent management solutions, has topped up its funding with another reportedly oversubscribed $35 million round. That makes an incredible $162 million since 2003. The l...
Best Buy founder and its largest shareholder Richard Schulze, 71, will be stepping down as chairman June 21 after a board investigation found he didn’t disclose CEO Brian Dunn’s “extremely close personal relationship” with a 29-year-old female employee to the board’s audit committee. ...
Citrix has acquired Virtual Computer, a little Massachusetts outfit with enterprise-scale management solutions for client-side virtualization. It means to combine the acquisition’s NxTop widgetry with its XenClient hypervisor to create a new Citrix XenClient Enterprise edition that c...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE