There has been a significant effort in developing complex, standards-based enterprise Web applications using a Java™ 2 Platform, Enterprise Edition (J2EE) programming model with the final presentation rendered using HTML mark up. Developers trying to speech-enable these applications are hindered by the lack of a standards-based approach. Commonly used approaches include authoring the presentation layer with static VoiceXML mixed inside the server side code, or by coding Java ServerPage (JSP) pages to dynamically generate the VoiceXML code directly. Both approaches have a significant negative impact on reuse and maintenance, though. The resulting code not only handles the application logic, but also has voice-specific code to handle dialog flow such as re-prompts, help, no-match, and so on, which makes it almost impossible to design, reuse, extend, or maintain. Further, this approach has another drawback in that it fails to separate developers' roles based on their expertise. Typically, Web developers code the application logic on the server side to connect to back-end applications; speech application developers are expert in creating grammars, dialog handling, speech recognition systems, and Text-to-Speech systems; Voice User Interface designers are experts in designing a good Voice Interface for handling the right prompts, responses, and so on.
The Reusable Dialog Components (RDCs) framework is designed around the J2EE/JSP programming model and provides a Web-tier approach to voice-application development that fits well with the J2EE multitier model. RDCs constitute a custom JSP tag library, which application developers can use within a JSP page. Each custom tag in the server environment generates the appropriate VoiceXML 2.0 code. The complexity of dialog management is hidden in the tag files. These tags are responsible for generating voice output, collecting and validating information from the user, formatting the data in canonical form, and guaranteeing completeness. For details on RDC architecture, refer to the RDC Web site (see Resources).
RDC applications and the WebSphere Voice Toolkit
The IBM® Voice Toolkit and the Rational® Application Developer (RAD) or Rational Web Developer (RWD) together make up all the tools needed to add speech to any existing Web applications or to develop a new speech-enabled Web application. RAD/RWD helps in developing multitier J2EE applications and Enterprise Java Bean (EJB) components. It also has a support for Struts-based application development. The Struts builder helps to design Model-View-Controller- (MVC) based applications in which the Model is a Bean, the Controller is a set of action classes with configuration files, and the View is a JSP page rendering the User interface; in our case, Voice User Interface.
The struts builder helps to lay out the overall Web application and identify various components. Figure 1 shows a simple Web Application in the Struts Builder. The JSP renders HTML markup.
Figure 1. A Struts-built Web application

The Voice Toolkit provides all the tools needed to develop, debug, and deploy voice applications. The Call Flow Builder (CFB), an easy to use graphical tool for visual components of a voice application, allows for the design and development of a voice application. The latest version of Call Flow Builder now supports application development using RDCs. By creating a Call Flow Builder file in the Voice Toolkit, you can drag and drop RDCs from a rich library of prebuilt components onto the canvas. The developer can also add any VoiceXML elements like prompt, decision, or disconnect from the Call Flow palette. Figure 2 shows a simple Call Flow, which includes two RDCs and two statement components from the palette.
Figure 2. A Call Flow, including two RDCs and two statement components from the palette

By placing the generic, preconfigured RDC components on the canvas, you can now customize each component by overriding the default prompts. Figure 3 shows how to override the default configurations for an RDC. Each RDC has an extensive set of properties you can customize, including No-Input 1, No-Input 2, No-Input 3, No-Match, and Help to name a few. For example, the digits "RDC" have generic values; the default prompt says, "Please say each digit of the desired number." If this component is used to capture a User ID, it can be customized to prompt, "Please say your User ID, one digit at a time." by overriding the default value.
After the RDCs are customized, the layout can be completed by connecting all of the objects on the canvas. The code that is then generated will be ready to deploy as JSP code in a Web project. The Call Flow Builder generates all the JSP code needed by the framework in addition to the code necessary for making calls to the individual RDCs. RDCs are shipped with default configuration files for getting up and running quickly. The RDC Properties Dialog (Figure 3) can aid in modifying those default configurations, creating customized configuration files for the framework to consume.
Figure 3. The RDC properties dialog

Developing an RDC using the Voice Toolkit
After installing WebSphere™ Studio, download the Voice Toolkit Technical Preview 6.0 Installer (see Resources) from the Voice Toolkit Web site, which will support development of RDC-based applications. Download the latest RDC library from the Apache site (see Resources). The RDC custom tag library (taglib-rdc.jar) requires a servlet container that supports the JSP 2.0 specification or higher. You must add jstl.jar and standard.jar to the WEB-INF\lib folder from the Apache project. You can use Jakarta Tomcat to test your application. You can use the WebSphere Application Server Version 6.0 test environment, included with RAD/RWD, to test your application.
- Create or open a dynamic Web project inside WebSphere RAD/RWD Studio.
- After coding the server side logic, create/edit the view by switching to the Voice perspective.
- Import the RDC library palette files from the Voice Toolkit library directory (%RAD%\VoiceToolkit\Libraries\RDC).
- Create a Communication Flow Builder file, and drag and drop the required RDC components from the RDC library.
Refer to the RDC documentation inside the Voice Toolkit for further details. After the JSP code is generated (right-click and select Generate JSP), you can insert additional logic inside the generated JSPs and connect back to the rest of the framework for making appropriate calls to the RDC components, which return a canonical value from Voice Input.
Running the RDC application using the Voice Toolkit
The project can now be run in the WebSphere Application Server Version 6.0 Test environment inside RAD/RWD, or can be exported as a WAR file. To run the application on a Tomcat server, this WAR file can be deployed on a Tomcat server by copying the WAR file into the webapps directory. Follow the server setup instructions from the Apache RDC Web site (see Resources). Use Internet Explorer to verify that the Tomcat server is running (http://localhost:8080/">http://localhost:8080/). Modify the URL to point to your application and make sure you can view the first page in Internet Explorer. RDCs generate VoiceXML 2.0 code and after the application is running, you can use the Voice Toolkit's Call Simulator to run the application. Use the Voice Toolkit to create a new Launch Configuration for a VoiceXML application. Select Remote VoiceXML URL and use the above URL to run/debug the application. If you need to modify any prompts, you can do so by opening the RDC Properties dialog for that RDC and modifying the values. Save and redeploy the WAR file, then rerun the VoiceXML application in the Voice Toolkit.
Developing your own RDC component
The RDC custom tag library, submitted by IBM to Apache, consists of several basic and high-level components. The basic components provide a well-defined dialog structure to collect simple elements of the application (for example, Digits, Date, Name, and so on) by generating appropriate VoiceXML 2.0 code, which will run on a VoiceXML browser. If you need to extend these basic RDCs or develop your own, the RDC framework provides a well-defined component structure. Each atomic or composite component can be composed further into bigger components using recursive composition. To develop these components, the Voice Toolkit includes a VoiceXML editor, which will aid in writing VoiceXML fragments. This editor has a Content Assist feature, which shows a list of valid tags at the current cursor position when you type an open bracket or when you press [Ctrl] + [Space]. The editor also validates the VoiceXML fragment and flags any VoiceXML syntax errors.
The RDC components might also involve developing grammars to be used inside VoiceXML code. The toolkit simplifies the development of rule grammars, and it also aids in testing these grammars with grammar editors and a grammar test tool. After the deployed application is ready to test, refer to Running the RDC application using the Voice Toolkit to run the application. You can set conditional or unconditional breakpoints in the source code for use with the VoiceXML Debugger and start the launch configuration in Debug mode. Optionally, you can run a session to test the fragment using the Call Simulator by launching the configuration in Run mode. After the component is tested, it is ready to be used inside a JSP page by other developers. A point to note is that RDC components are assembled within a container tag called a group tag, which hosts the dialog components and carries out the dialog management across the components. The components are responsible for returning the appropriate information to the application. For details on the Public Contract, refer to RDC documentation on the Apache Web site (see Resources).
The IBM Voice Toolkit includes all necessary tools for speech-enabling Web applications using the RDC framework. The components hosted inside a JSP page can be easily developed and configured. The remaining components of the application, such as the application logic and dialog flow, and so on can be developed using WebSphere Rational Studio. Both tools provide a powerful suite for enterprise-level Web-based VoiceXML applications using the RDC framework.
- Download Rational™ Studio trial copy.
- After installing Rational Studio, download the Embedded Voice Toolkit Preview from alphaWorks.
- Download the RDC tab library from Apache's site.
- Download the latest RDC library from the Apache site to take a look at the RDC tag library.
- From the Apache Jakarta Web site, you can also download a binary distribution of Tomcat.
- For details on RDC architecture, refer to the RDC Web site.
- Browse for books on these and other technical topics.

Girish Dhanakshirur is a Staff Software Engineer with IBM. Girish has led component development for various voice products at IBM over the last seven years. His portfolio includes development of ViaVoice, the WebSphere Transcription Server, Voice Server, and Voice Application Access products. Currently, he is responsible for Reusable Dialog Component (RDC) Tooling initiatives. You can reach Girish at girid@us.ibm.com.
