Welcome!

Machine Learning Authors: Zakia Bouachraoui, Liz McMillan, Roger Strukhoff, Pat Romanski, Carmen Gonzalez

Related Topics: Industrial IoT

Industrial IoT: Article

Developing Voice XML Applications Using Microsoft.NET

Developing Voice XML Applications Using Microsoft.NET

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/

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.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


CloudEXPO Stories
The precious oil is extracted from the seeds of prickly pear cactus plant. After taking out the seeds from the fruits, they are adequately dried and then cold pressed to obtain the oil. Indeed, the prickly seed oil is quite expensive. Well, that is understandable when you consider the fact that the seeds are really tiny and each seed contain only about 5% of oil in it at most, plus the seeds are usually handpicked from the fruits. This means it will take tons of these seeds to produce just one bottle of the oil for commercial purpose. But from its medical properties to its culinary importance, skin lightening, moisturizing, and protection abilities, down to its extraordinary hair care properties, prickly seed oil has got lots of excellent rewards for anyone who pays the price.
The platform combines the strengths of Singtel's extensive, intelligent network capabilities with Microsoft's cloud expertise to create a unique solution that sets new standards for IoT applications," said Mr Diomedes Kastanis, Head of IoT at Singtel. "Our solution provides speed, transparency and flexibility, paving the way for a more pervasive use of IoT to accelerate enterprises' digitalisation efforts. AI-powered intelligent connectivity over Microsoft Azure will be the fastest connected path for IoT innovators to scale globally, and the smartest path to cross-device synergy in an instrumented, connected world.
There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
ScaleMP is presenting at CloudEXPO 2019, held June 24-26 in Santa Clara, and we’d love to see you there. At the conference, we’ll demonstrate how ScaleMP is solving one of the most vexing challenges for cloud — memory cost and limit of scale — and how our innovative vSMP MemoryONE solution provides affordable larger server memory for the private and public cloud. Please visit us at Booth No. 519 to connect with our experts and learn more about vSMP MemoryONE and how it is already serving some of the world’s largest data centers. Click here to schedule a meeting with our experts and executives.
Darktrace is the world's leading AI company for cyber security. Created by mathematicians from the University of Cambridge, Darktrace's Enterprise Immune System is the first non-consumer application of machine learning to work at scale, across all network types, from physical, virtualized, and cloud, through to IoT and industrial control systems. Installed as a self-configuring cyber defense platform, Darktrace continuously learns what is ‘normal' for all devices and users, updating its understanding as the environment changes.