| By Hitesh Seth | Article Rating: |
|
| June 3, 2001 12:00 AM EDT | Reads: |
12,132 |
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;Visual Basic.NET
public class HelloWorld
{
public static void Main()
{
String msg = "Hello World from C#";
Console.WriteLine(msg);
}
}
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:
#usingJScript.NETusing namespace System;
void main()
{
String *msg = L"Hello World from
Managed C++";
Console::WriteLine(msg);
}
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#"Executing the Web Service with a browser using the URL http://localhost/HelloService.asmx/SayHello returns the following XML:
class="SeraNova.HelloService" %>
namespace SeraNova
{
using System;
using System.Web.Services;
public class HelloService :
WebService
{
[ WebMethod ]
public String SayHello()
{
return "Hello Web Services";
}
}
}
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;Conclusion
public class UsingService
{
public static void Main()
{
HelloService service = new
HelloService();
String msg = service.SayHello();
Console.WriteLine(msg);
}
}
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
- Microsoft .NET Home Page: www.microsoft.com/net
- MSDN Online .NET Developer Center: http://msdn.microsoft.com/net
- .NET Framework SDK Beta 1: http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/msdn-files/027/000/976/msdncompositedoc.xml
- Visual Studio.NET: http://msdn.microsoft.com/vstudio/nextgen/default.asp
- The MSDN Show:http://msdn.microsoft.com/theshow/
Published June 3, 2001 Reads 12,132
Copyright © 2001 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By 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.
- Agile Adoption – Crossing the Chasm
- Cloud Expo New York: The Java EE 7 Platform - Developing for the Cloud
- Write Once Run Anywhere or Cross Platform Mobile Development Tools
- Cross-Platform Mobile Website Development – a Tool Comparison
- Architecture Governance – the TOGAF Way
- Twelve New Programming Languages: Is Cloud Responsible?
- It's the Java vs. C++ Shootout Revisited!
- Cloud Expo New York Speaker Profile: Arun Gupta – Oracle
- Agile Development & Enterprise Architecture Practice – Can They Coexist?
- Cloud Expo New York: Industry-Leading CxOs to Present June 11-14
- Component Development and Assembly Using OSGi Services
- Big Data: Information Spawns Innovation
- Agile Adoption – Crossing the Chasm
- Graal, a Dynamic Java Compiler in the Works
- Cloud Expo New York: The Java EE 7 Platform - Developing for the Cloud
- Write Once Run Anywhere or Cross Platform Mobile Development Tools
- Cross-Platform Mobile Website Development – a Tool Comparison
- Architecture Governance – the TOGAF Way
- Google Analytics with Monitis Dashboard
- Twelve New Programming Languages: Is Cloud Responsible?
- It's the Java vs. C++ Shootout Revisited!
- Cloud Expo New York Speaker Profile: Arun Gupta – Oracle
- Scaling Java and JSP Apps with Distributed Caching
- Agile Development & Enterprise Architecture Practice – Can They Coexist?
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- JavaServer Faces (JSF) vs Struts
- The i-Technology Right Stuff
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- What's New in Eclipse?
- i-Technology Predictions for 2007: Where's It All Headed?


















