Oracle9iAS Wireless Developer's Guide Release 2 (9.0.2) Part Number A90485-02 |
|
Each section of this document presents a different topic. These sections include:
Before examining the properties of writing mobile XML to handle text formatting from a small device and voice perspective, this chapter will help you gain the skills to write effective user interfaces to capture the required business logic with the least amount of effort by mobile users. We will examine the details of creating Oracle9iAS Wireless XML pages containing navigation elements such as menus, hyperlinks, email, help, and cover forms. The elements necessary to build a form are different from a menu as these will be the core elements needed for a wireless developer to build an effective mobile application that simplifies user input without compromising a rich feature set across different devices.
Because voice navigation is inherently more complicated than in small screen devices, this chapter focuses on the fundamentals of Oracle9iAS Wireless XML for small devices and highlights the required voice additions.
Menus allow consumers of services to simply navigate to a predefined choice and enable different URLs to be invoked for a given choice. Forms, on the other hand, typically differ from Menus in that there is one target which dictates the user's next page based on user input.
The SimpleMenu element represents a single menu with selectable menu items defined by SimpleMenuItem elements. It is possible to add Images to the top of each Menu. However, one needs to avoid using large titles and images. See SimpleMenuExample.xml for an example.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC " = //ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer> <SimpleMenu> <SimpleTitle>OracleMobile Services <SimpleImage src=" http://portal.oraclemobile.com/other/oow/oramobile"alt="Oracle Software Powers the Internet"/> </SimpleTitle> <SimpleMenuItem target="mission.xml">OracleMobile MissionStatement</SimpleMenuItem> <SimpleMenuItem target="timer.xml">Oracle Server</SimpleMenuItem> <SimpleMenuItem target="email.xml">Email the authors</SimpleMenuItem> </SimpleMenu> </SimpleContainer> </SimpleResult>
The system reads the items of menu elements and concurrently listens for the values of the SimpleMenuItem element. If one of these values is recognized, then the target URL is fetched. If the user says nothing, the system will prompt the user with a system default noinput message. If the user says something and the system is unable to recognize it, the system default nomatch message is played. However, application programmer may control such messages. Such fail-over logic is critical for making robust voice applications. Application developers should make extensive use of such features. For menus with large number of items, voice interfaces should not read out the entire menu items to the user by setting the autoprompt attribute to false. Instead, applications should wait for user input and should only present an options list as help if requested by user. See EnhancedSimpleMenuExample.xml for example. Some of the tags and elements used in the application are covered later in this chapter.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC " = //ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer> <SimpleMenu deviceclass="microbrowser pdabrowser pcbrowser micromessager messanger"> <SimpleTitle>OracleMobile Services <SimpleImage src="http://portal.oraclemobile.com/other/oow/oramobile" alt="Oracle Software Powers the Internet"/></SimpleTitle> <SimpleTitle>OracleMobile Services</SimpleTitle> <SimpleMenuItem target="mission.xml">OracleMobile MissionStatement</SimpleMenuItem> <SimpleMenuItem target="timer.xml">Oracle Server</SimpleMenuItem> <SimpleMenuItem target="email.xml">Email the authors</SimpleMenuItem> </SimpleMenu> <SimpleMenu deviceclass="voice" autoprompt="false"> <SimpleTitle> <SimpleAudio src="title.wav">oracle mobile services </SimpleAudio> </SimpleTitle> <SimpleMenuItem target="mission.xml">OracleMobile MissionStatement <SimpleGrammer>mission statement{}| oracle mission statement{} </SimpleGrammer> </SimpleMenuItem> <SimpleMenuItem target="timer.xml">Oracle Server <SimpleGrammer>oracle server{}| server{} </SimpleGrammer> </SimpleMenuItem> <SimpleMenuItem target="email.xml">Email the authors <SimpleGrammer>email the authors{}| email{} | email authors{} </SimpleGrammer> </SimpleMenuItem> <SimpleCatch type="nospeech"> <SimpleAudio src="menuOptions.wav">Please speak up. You may also say help. </SimpleAudio> </SimpleCatch> <SimpleCatch type="nomatch"> <SimpleAudio src="nomatch.wav">I'm sorry, I did not understand you. Please say that again or say help.</SimpleAudio> </SimpleCatch type="help"> <SimpleAudio src="menuHelp.wav"> Help. Oracle Mobile. You may say mission statement, oracle server or email the authors. </SimpleAudio> </SimpleMenu> </SimpleContainer> </SimpleResult>
The output of this application on small screen devices is the same as shown above, while a typical voice session may be as follows:
System: oracle mobile services User: help System: Help. Oracle Mobile. You may say mission statement, oracle server or email the authors. User: I am going to trick you. System: I'm sorry, I did not understand you. Please say that again or say help. User: email authors ...
Generally, voice gateways provide a text-to-speech (TTS) engine that reads out SimpleTitle, SimpleTextItem, SimpleMenu options, SimpleFormOptions etc. For the TTS to sound intelligible, proper spacing and punctuation is required. SimpleFormOption or SimpleMenuItem should never have text punctuation unless the deviceclass has been set to a value other than "voice". This is because the text in these tags is used to produce speech recognition grammars, and most grammars are foiled by non-alphabetic characters. If a developer wishes to avoid using the synthesized message, then he may specify a prerecorded audio file to be played. The location of the audio file can be specified through the <SimpleAudio> tag. End user experience of TTS is often considered unpleasant, So as much as possible, prerecorded human sounds should be used instead of TTS.
For linking documents, SimpleHref can be used as a hyperlink. It can also be used to send email using the mailto: handler as shown in the ContactAuthors.xml and PhoneCallDemo.xml examples. Similarly, the callto:handler can be used for devices that are capable of making phone calls. Application developers should specify deviceclass attributes which support the call or mail feature.
Note: static_target attribute should be used instead of target whenever callto: or mailto: handlers are used which signals Oracle9iAS Wireless runtime not to rewrite the URLs. |
SimpleTimer can be used to invoke a goto target task after a specified delay. It can be used for navigation to display a showcase promotion, sponsor information, or system-wide critical messages.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer> <SimpleText> <SimpleTextItem deviceclass="pdabrowser pcbrowser micromessenger messenger">Email the Authors only on clients with default mail clients like PocketPC and desktops <SimpleBreak/> <SimpleHref staic_target="mailto:chandra.patni@oracle.com">Chandra "duke" Patni </SimpleHref> <SimpleBreak/> <SimpleHref static_target="mailto:peter.feng@oracle.com">Peter "ptg" Feng </SimpleHref> </SimpleTextItem> <SimpleTextItem deviceclass="voice microbrowser">Call the Authors on clients with phone facility <SimpleBreak/> <SimpleHref static_target="callto:1234567890">Chandra "duke" Patni </SimpleHref> <SimpleBreak/> <SimpleHref static_target="callto:1234567890">Peter "ptg" Feng </SimpleHref> </SimpleTextItem> </SimpleText> </SimpleContainer> </SimpleResult>
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer> <SimpleText deviceclass="microbrowser voice"> <SimpleTextItem><SimpleEm>Oracle</SimpleEm> Support </SimpleTextItem> <SimpleTextItem>Phone Book<SimpleBreak/> <SimpleHref static_target="callto:14155551212">Bob</SimpleHref> <SimpleHref static_target="callto:16505551212">Chris</SimpleHref> <SimpleHref static_target="callto:14085551212">Dina</SimpleHref> <SimpleHref static_target="callto:17075551212">Jere</SimpleHref> </SimpleTextItem> </SimpleText> </SimpleContainer> </SimpleResult>
SimpleAction provides the ability to define a submit action, that navigates users to a new context. Mobile devices can associate a submit action to a number of input methods of the device, such as pressing a key on a WAP device or speaking a command on a voice-enabled device. SimpleAction can also be used for navigation to different pages and different cards within a deck, and overriding default behavior on voice browsers. For mobile phones, the main usage would be to override the buttons (left and right) on a wireless phone and PDAs to provide a similar navigation functionality as SimpleHref.
Like many programming languages, SimpleAction, for a given type, conforms to scoping rules. For example, if SimpleAction is defined as a child of SimpleMenu and also as a child of the enclosing SimpleContainer for a given type, the SimpleAction tag within the SimpleMenu overrides the SimpleAction of the SimpleContainer. If the value for type attribute is different, then the two SimpleActions will be active within the context. The behavior of SimpleAction is unspecified if two elements are defined with the same type and same deviceclass values in the same context. See the following example for usage.
SimpleCache enables you to specify caching policy of content either by the WAP gateway, by client browser, or both.
SimpleCache can be specified as the child of SimpleHref, SimpleGo, SimpleMenuItem, SimpleAction etc. SimpleCache also allows users to specify the prefetch policy (if supported by browser), where a URL must be prefetched while still showing the current content. However, if the SimpleAction specifies a submit task, then caching policies are not applicable. Time to live for the cached data is specified by the ttl attribute, which takes milliseconds as an argument.
SimpleCache should be used when the data is sensitive or becomes stale after a specified amount of time.
SimpleMeta allows applications to specify meta information via the device browser, and pass that information to the transformers.
SimpleDTMF specifies a VoiceXML DTMF grammar. In the voice application example the user may select menu item `test1' either by saying `test1' or by selecting `3' on the device.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult public="true"> <SimpleCache ttl="0"/> <SimpleContainer> <SimpleMenu markable="true" wrapmode="nowrap" autoprompt="false" dtmf="true"> <SimpleTitle>Voice demo</SimpleTitle> <SimpleMenuItem target="deposit.jsp">Deposit <SimpleAction task="go" method="get"/> <SimpleGrammar> deposit{} </SimpleGrammar> <SimpleDTMF>1</SimpleDTMF> </SimpleMenuItem> <SimpleMenuItem target="HelloWorld.jsp">Withdraw <SimpleAction task="go" method="get"/> <SimpleGrammar>withdraw{}</SimpleGrammar> <SimpleDTMF>2</SimpleDTMF> </SimpleMenuItem> <SimpleCatch type="cancel"> <SimpleAction target="cancel.jsp"/> </SimpleCatch> <SimpleCatch type="help"> <SimpleAudio src="help.wav">Help. For deposit, you may say deposit or press 1. For withdraw, you may say withdraw or press 2.</SimpleAudio> </SimpleCatch> <SimpleCatch type="help" count="2"> <SimpleAudio src="help.wav">Help. For deposit, you may say deposit or press 1. For withdraw, you may say withdraw or press 2. You may also say cancel to return to account menu.</SimpleAudio> </SimpleCatch> </SimpleMenu> </SimpleContainer> </SimpleResult>
SimpleCatch catches an event; it is a voice-only tag. This can be used to capture predefined voice events or error conditions such as "noinput", "nomatch", "exit", "cancel", "error", "help", "telephone.disconnect", etc. and perform actions on them. For example on a "noinput" event the user can be given some help instructions and be reprompted for their input. The event types are specified by type attribute which is mandatory for SimpleCatch. Also, count attribute may be used for occurrences of the event. The default value is 1. It allows handling of multiple occurrences of an event in multiple ways. For example the nth occurrence of an event can be handled in a different manner than the previous occurrence. In a frequently occurring scenario, it may be used for increasing details of help as count increases. See SimpleDTMF.xml for usage.
The SimpleGrammar tag provides a customized speech recognition grammar. Using this grammar, developers can not only provide the vocabulary to listen for, but also the mapping from, utterances to data values. If the rules for such mappings are in a remote location, then the src attribute may be used to specify the name of the file. The following example illustrates the use of SimpleGrammar.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer> <SimpleMenu deviceclass="voice"> <SimpleTitle src="title.wav">Please select a freeway</SimpleTitle> <SimpleMenuItem target="./traffic.jsp?index=5">I 5 <SimpleGrammar>i five{} | interstate five{} | five{} | route five{} | san diego{} </SimpleGrammar> </SimpleMenuItem> <SimpleMenuItem target="./traffic.jsp?index=8 ">I 8 <SimpleGrammar>i eight{} | interstate eight{} | eight{} | route eight{} | alvarado freeway{} | mission valley freeway{} | ocean beach freeway{} </SimpleGrammar> </SimpleMenuItem> <SimpleMenuItem target="./traffic.jsp?index=15 ">I 15 <SimpleGrammar>i fifteen{} | fifteen{} |interstate fifteen{} | escondido freeway{}| escondido{} </SimpleGrammar> </SimpleMenuItem> <SimpleMenuItem target="./traffic.jsp?index=805 ">I 805 <SimpleGrammar>i eight zero five{} | i eight hundred five{} | eight zero five{} | eight hundred five{} | interstate eight zero five{} | interstate eight hundred five{} | route eight zero five{} | route eight hundred five{} </SimpleGrammar> </SimpleMenuItem> </SimpleMenu> </SimpleContainer> </SimpleResult>
In the above example, even though the last menu option is "i eight hundred five", the user may say any one of the commands as specified by a `|' separated list. SimpleGrammer is a very useful construct for building user-friendly and smart voice applications. It also allows application developers to incorporate some of their localization issues. For example, "sure", "ok", "yes", "please" and "yes please" all are used to refer to "yes" (in America region) in different parts of world. Such speech diversity can be incorporated into an application using SimpleGrammer.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer id="message"> <SimpleTimer target="#employeePortal" timer="30"/> <SimpleText> <SimpleTextItem> There will be ice cream bars in every lobby at Headquarters to promote the use of the new employee wireless portal. </SimpleTextItem> </SimpleText> </SimpleContainer> <SimpleContainer> <SimpleText id="employeePortal"> <SimpleImage valign="top" src= http://portal.oraclemobile.com/other/oow/oraclemobile alt="oraclemobile icon"/> <SimpleTextItem>Welcome to <SimpleEm>OracleMobile</SimpleEm> Employee Portal <SimpleBreak/> </SimpleTextItem> <SimpleAction type="SOFT1" label="Support" target="phone.xml"/> <SimpleHref label="PORTAL" id="portal" name="ToPortal" target="form.xml"> enterPortal </SimpleHref> </SimpleText> </SimpleContainer> </SimpleResult>
Basic Voice Commands
The following basic commands are available to users at all times. The response of the system to help and cancel will generally need to be tailored to each individual service.
Main menu: Can be uttered at any time, and by default takes the user to the Oracle9iAS Wireless main menu.
Goodbye: To end the session with one Oracle9iAS Wireless instance or user may just hang up the telephone.
Exit: Same as Goodbye.
Help: For context-sensitive help>
Cancel: For aborting or restarting a dialog, as when the system has misrecognized a command or input.
Help is used by voice applications to provide context-sensitive help when users invoke "help" commands. Voice interfaces should make use of Help as much possible. Unlike small screen application help, voice help is vital to the navigation of voice interfaces and therefore should be incorporated at development time. See EnhancedSimpleMenuExample.xml for usage.
|
![]() Copyright © 2002 Oracle Corporation. All Rights Reserved. |
|