YOUR FEEDBACK
Chris Keene's Prescription for Curing the Java Flu
Rob wrote: I have to agree with Chris - I have been a developer and Java a...
SOA World Conference
Virtualization Conference
$200 Savings Expire May 16, 2008... – Register Today!


2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TODAY'S TOP SOA & WEBSERVICES LINKS


Developing Voice XML Applications Using Microsoft.NET

Digg This!

In this fourth article in the "Spotlight on VoiceXML" series we return to our hands-on approach for developing VoiceXML applications. In Part 1 we cover the basic fundamentals of the new Microsoft .NET Framework and its components. In Part 2 we'll apply .NET technologies, particularly ASP.NET, C#, and Web Services, to build an interactive VoiceXML application.

From a developer's perspective the Microsoft .NET Framework is an environment for developing, deploying, and executing applications - traditional Windows and Web-based applications as well as dynamic Web Services. With a rich set of class libraries and the flexibility of multiple languages the .NET Framework allows developers to focus on creating application business/presentation logic and leave the "plumbing" work to the underlying framework.

The .NET Framework is currently in beta. More information is available on the .NET home page or at the MSDN Online .NET Developer Center, both at www.microsoft.com/net/.

The .NET Framework comprises the following components - runtime, class libraries, supported languages, and ASP.NET (see Table 1).

.NET Common Language Runtime
At the heart of the .NET Framework is the common language runtime (CLR). Technically speaking, the runtime represents four constituents - common type system (CTS), common language specification (CLS), virtual execution system (VES), and the underlying metadata that provides a common interchange mechanism. Basically, the runtime provides an object and type system that's common across the .NET-compatible languages and is responsible for performing all the groundwork - memory allocation, thread/process management, managing security, and more. .NET-based programs are compiled into an instruction set called Microsoft intermediate language (MSIL), which is both language- and CPU-independent. However, MSIL is not interpreted. It's converted into machine code before the programs are executed.

.NET Class Libraries
.NET class libraries are a rich, comprehensive set of classes that provide pre-built functionality to the .NET programming model. They include a class hierarchy for functionality around user interface development, Web Services, database access, networking, input/output, XML/ XSL processing, security, and more.

.NET Languages
The .NET Framework SDK (the current beta 1 version) lets you use four languages to develop .NET applications and components - C#, Visual Basic.NET, Visual C++ (with extensions), and JScript.NET. (Note: The .NET Framework allows third parties to create their own language bindings as well.)

C#
C# (pronounced C-sharp), introduced by Microsoft with .NET, is a simple, object-oriented programming language. The goal of C# is to provide developers with the power and richness of C++ and the ease and simplicity of Visual Basic. We'll use C# in Part 2 when we develop our VoiceXML application. Here's the famous "Hello World" application using C#.

using System;
public class HelloWorld
{
public static void Main()
{
String msg = "Hello World from C#";
Console.WriteLine(msg);
}
}
Visual Basic.NET
Visual Basic.NET (a.k.a. Visual Basic version 7.0) is the next major revision from Visual Basic 6.0. It now supports core object-oriented programming constructs such as inheritance, structured exception handling, overloading methods/properties/procedures, constructors and destructors, interfaces, and delegates. Visual Basic.NET now also supports the "Free Threading" Model, previously available to C++ developers only. Let's look at "Hello World" again using Visual Basic.NET.
Imports System
Module MainModule
Sub Main()
Dim msg As String
msg = "Hello World from Visual Basic.NET"
Console.WriteLine(msg)
End Sub
End Module

Visual C++
The .NET SDK/Framework provides a set of managed extensions to the C++ programming language that empowers the C++ language with a set of keywords and attributes, enabling the underlying C++ language to use a .NET component to wrap/migrate existing C++ applications to the .NET environment. The following is what our Hello World example looks like in managed C++. Notice the usage of the .NET classes String and Console. Note: The C++ compiler can be triggered to use the .NET runtime by using the "/CLR" switch; for example, cl/CLR HelloWorld.cpp would be able to compile the following program:

#using using namespace System;
void main()
{
String *msg = L"Hello World from
Managed C++";
Console::WriteLine(msg);
}
JScript.NET
JScript.NET is an implementation of the standard ECMAScript language. It's a strongly typed programming language that provides core benefits, such as improved execution speed, strong type checking, and easy-to-read code. Let's see the how the simplicity in JScript shows up in the following JScript.NET-based application.
import System;
var msg = "Hello World from
JScript.NET";
Console.WriteLine(msg);

ASP.NET
ASP.NET is the next generation of the Active Server Pages (ASP) Web development environment for creating dynamic applications. It allows application developers to use any of the .NET-supported languages (including JScript, C#, and Visual Basic) as a scripting language within a page model. ASP.NET has major advances from ASP, including full support of .NET languages (and not just a scripting derivative), configurable session management, and the concept of server-based Web controls.

<%@ Page language="C#"
ContentType="text/html" %>



<%
Sting msg = "Hello World from ASP.NET";
%>
<%=msg%>

Web Services
A key feature of .NET is that it makes the creation of Web Services as simple as developing a dynamic Web page. For example, the following script creates a full-featured SOAP-based service called HelloService with a method SayHello that returns a string message. .NET Framework-based Web Services use Simple Object Access Protocol (SOAP) for communication and Service Description Language (SDL) to represent the description and metadata for a service.

<%@ WebService Language="C#"
class="SeraNova.HelloService" %>
namespace SeraNova
{
using System;
using System.Web.Services;
public class HelloService :
WebService
{
[ WebMethod ]
public String SayHello()
{
return "Hello Web Services";
}
}
}
Executing the Web Service with a browser using the URL http://localhost/HelloService.asmx/SayHello returns the following XML:

Hello World from Web Services

The returned XML can then be processed by any application that has XML-processing capabilities.

It's also possible to invoke the Web Service as part of another .NET application or component, after proxy classes have been generated for the appropriate language bindings.

using System;
public class UsingService
{
public static void Main()
{
HelloService service = new
HelloService();
String msg = service.SayHello();
Console.WriteLine(msg);
}
}
Conclusion
The .NET Framework builds on top of the popularity of ASP and COM/DCOM-based Web applications, and is poised to become a popular development platform for building multitier, Web-based applications and services. In Part 2 we'll apply the various components of the .NET Framework to create VoiceXML-based interactive applications.

References

  1. Microsoft .NET Home Page: www.microsoft.com/net
  2. MSDN Online .NET Developer Center: http://msdn.microsoft.com/net
  3. .NET Framework SDK Beta 1: http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/msdn-files/027/000/976/msdncompositedoc.xml
  4. Visual Studio.NET: http://msdn.microsoft.com/vstudio/nextgen/default.asp
  5. The MSDN Show:http://msdn.microsoft.com/theshow/
About Hitesh Seth
Hitesh Seth is chief technology officer of ikigo, Inc., a provider of XML-based web-services monitoring and management software. A freelance writer and well-known speaker, he regularly writes for technology publications on VoiceXML, Web Services, J2EE and Microsoft .NET, Wireless Computing & Enterprise/B2B Integration. He is the conference chair for VoiceXML Planet Conference & Expo.

XML JOURNAL LATEST STORIES . . .
EDI to XML: A Practical Approach
While EDI transactions account for most worldwide commercial activity, XML-based alternatives are beginning to gain traction. According to Forrester Research, stateful XML, stateless XML, and even flat file exchanges are all projected to grow at a faster rate than EDI over the next few
3rd International Virtualization Conference & Expo: Themes & Topics
From Application Virtualization to Xen, a round-up of the virtualization themes & topics being discussed in NYC June 23-24, 2008 by the world-class speaker faculty at the 3rd International Virtualization Conference & Expo being held by SYS-CON Events in The Roosevelt Hotel, in midtown
Red Hat Named "Platinum Sponsor" of Virtualization Conference & Expo
Red Hat is a trusted open source provider. Red Hat offers enterprise customers a long-term plan for building infrastructures on the quality and innovation of open source. Combining open source operating system platform, Red Hat Enterprise Linux, together with applications, management
JustSystems Contributes Key XBRL Rendering Technology to Financial Community
JustSystems announced that it is contributing intellectual property rights for its invention of eXtensible Business Reporting Language (XBRL) rendering technologies to XBRL International, the standards body responsible for the oversight of the XBRL specification. The invention, known a
JustSystems Launches Campaign for XBRL Success
JustSystems announced its campaign to help organizations adopt XBRL (eXtensible Business Reporting Language), the XML-based standard for communicating financial and business information. In related news, JustSystems also announced that it has contributed intellectual property rights of
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
BREAKING XML NEWS
SAP Accelerates the Path to SOA for Customers
has led to customer requests for training and education involving SAP's proven design and de