Developing and Debugging VoiceXML
As your voice applications get more complex, it’s important to be able to debug problems with your VoiceXML. Many voice servers provide logs that indicate problems with an application. However, searching through log files can be time-consuming. Catching errors predeployment can make development move a lot faster.
When your VoiceXML file is ready to be uploaded on the web server of your choice, there are two things that can go wrong: the voice server can’t find your file; or the server finds it, but reports a cryptic error message.
File Not Found
Various voice servers respond differently when they can’t locate your VoiceXML file, so it’s important that you independently verify file availability. One way to do this is to open a browser and enter the URL of your voice document. If the browser can’t find your file, you’ll get a File Not Found message. If it can, it will display the file in some form. But remember that browsers react differently when loading XML, so don’t get confused if you see a strange variant of your VoiceXML in your browser window.
If you have an error in your XML, you may or may not get an informative message from your voice server. Voxeo, for example, will report Internal Error Has Occurred and then hang up. If this occurs, the easiest thing to do is to validate your XML against a VoiceXML schema. For VoiceXML there is both a DTD and an XML Schema that you can use to your advantage to check the validity of your VoiceXML
Listing 5 shows a simple VoiceXML document that includes references to the official DTD and XML Schema for VoiceXML 2.0.
Listing 5 VoiceXML Document with DTD and SML Schema references
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE vxml SYSTEM "http://www.w3.org/TR/voicexml20/vxml.dtd"> 3 <vxml version = "2.0" xmlns=’http://www.w3.org/2001/vxml’ 4 xmlns:xsi=’http://www.w3.org/2001/XMLSchema-instance’ 5 xsi:schemaLocation=’http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd’> 6 <form> 7 <block> 8 <prompt>hello from x m l land. This is my first voice program. </prompt> 9 </block> 10 <goto next="document2.vxml"/> 11 </form> 12 </vxml>
When your VoiceXML includes the above DTD and XML Schema references, there are various options for checking validity. One quick and painless way to validate your XML is to use the VALIDOME web site, which lets you to enter a URL, upload a file or simply paste your VoiceXML into a text area on the web page. To validate your XML, simply press the VALIDATE button, and VALIDOME will report any semantic errors in your VoiceXML. Believe me, this will save countless hours trying to spot a problem visually.
Figure 3 shows the setup I use on my desktop to experiment with and develop voice applications.
Figure 3 Desktop workflow for developing VoiceXML applications