202 Chapter 5 • Wireless Development Kits The setup program will be unpacked and then run.The Motorola logo will appear on your screen for a moment and then a dialog box welcoming you to the install will appear. Click Next to begin the installation.You will have to accept the License Agreement by clicking Ye s on the next screen.The install pro- gram will then ask for your name and organization; enter them and click Next to continue. Choose the defaults for the installation directory and Program Group, and then the installer will copy the software to your machine. You cannot launch the Wireless IDE yet because you have to install a target device for it to work with. In our case, this is the Mobile ADK and its related devices. Run the MobileADK2_0.exe installation program and a dialog box telling you this is the MADK 2.0 SDK installer will appear. Click Next to bring up the screen that asks you where to unpack the setup files.Accept the default location and click Continue to unpack the setup program and run it.The Motorola logo will appear on the screen for a moment, and then the setup pro- gram will show the initial screen shown in Figure 5.15. Click Next to start the installation.You will be told to ensure that the Wireless IDE is already installed and that you are installing the Mobile ADK to the same location as you did the Wireless IDE on the next screen.We have www.syngress.com Figure 5.15 Initial Motorola Mobile ADK Installation Screen 159_wi_wg_05 10/22/01 4:35 PM Page 202 Wireless Development Kits • Chapter 5 203 installed the Wireless IDE and will be installing the Mobile ADK to the same location, so click Next to continue.The License Agreement is then shown. If you agree to the terms, click Ye s to continue with the installation.The next screen asks you for your name, your company’s name, and your serial number as shown in Figure 5.16. Motorola e-mails the serial number to you. If you did not get your license key e-mailed to you, contact Motorola through their Web site.The e-mail you receive should include some additional instructions that may be relevant to your installa- tion. Enter the license key, which is in the form: SPSDK-nnn-nnnnn-nnnn, then click Next.You can choose the default locations for the installation directory and Program Groups by clicking Next on the following two screens. Depending on what software you already have installed, you may have to go through the setup programs for Microsoft Agent and Speech Recognition software.This will include agreeing to some license agreements and choosing some options.The Speech Recognition software will bring up the dialog box shown in Figure 5.17. This begins the process of ensuring that your microphone and speakers are correctly hooked up. If you do not wish to work with VoiceXML, you can skip this step by clicking Cancel.You can always adjust the microphone settings later through the Speech applet in the Control Panel.A final screen is shown indi- cating that all the software was installed correctly. Click Finish to complete the installation process. www.syngress.com Figure 5.16 Serial Number Verification Screen for the Motorola Mobile ADK 159_wi_wg_05 10/22/01 4:35 PM Page 203 204 Chapter 5 • Wireless Development Kits Using the Mobile ADK The Mobile ADK is project based.You will have to start a new project to begin using the software. Select Programs | Motorola Wireless IDE | Wireless IDE from the Start menu to launch the application.The initial dialog box will ask you if you wish to open a new or existing project.We want to start a new project because this is the first time we’ve used the Mobile ADK. Select Open a new Wireless IDE Project.You will then be asked to fill in the name of the project, where the source files are located, and from what directory the project will be run. Let’s name our project mobileADK, make our source directory c:\wml\madk\, and our run directory c:\wml\madk\run\ (as shown in Figure 5.18); click Next to continue. The next dialog box asks us to select a predefined application as a starting point for your code.The available options are shown and explained in Table 5.1. Table 5.1 Explanation of Wireless IDE Predefined Application Types Predefined Application Name Project Description MADK2_0.asp Microsoft ASP project ASP can be used to generate a variety of other markup lan- guages including VoxML, VoiceXML, WML, and HTML. www.syngress.com Figure 5.17 Microsoft Speech Recognition Setup Screen Continued 159_wi_wg_05 10/22/01 4:35 PM Page 204 Wireless Development Kits • Chapter 5 205 MADK2_0.vml VoxML project VoxML is Motorola’s propri- etary voice markup language. Motorola is moving towards VoiceXML, and this support is mostly for legacy applications. MADK2_0.vxml VoiceXML project VoiceXML is a joint effort by IBM, AT&T, Lucent, and Motorola to combine various proprietary voice markup lan- guages into one standard. The World Wide Web Consortium Voice Browser Working Group used VoiceXML as a model for its Dialog ML specification. MADK2_0.wml WML application This provides a basic WML deck as a starting point for your application. We want a WML application, so let’s choose MADK2_0.wml as our starting point and click Finish to start working with the Wireless IDE. www.syngress.com Figure 5.18 Creating a New Project in the Motorola Wireless IDE Table 5.1 Continued Predefined Application Name Project Description 159_wi_wg_05 10/22/01 4:35 PM Page 205 206 Chapter 5 • Wireless Development Kits Accessing and Editing Local Files The Wireless IDE automatically creates a file called mobileADK.wml for you. Let’s insert our “Hello World!” contents into this file: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd"> <wml> <card id="hello" title="Hello World"> <p>Hello World!</p> </card> </wml> Let’s validate the file to make sure it will work correctly. Select File | Save from the menu bar to save the file.Then select Project | Compile File to compile it.You should see a new pane appear underneath your source window that says no errors were found.Your Wireless IDE should now look like the one shown in Figure 5.19. www.syngress.com Figure 5.19 The Motorola Wireless IDE with No Errors 159_wi_wg_05 10/22/01 4:35 PM Page 206 Wireless Development Kits • Chapter 5 207 We have no errors, so we should be able to look at it in the simulator now. You can launch the current file in the simulator by selecting the Simulator | Run menu option in the Wireless IDE.A new simulator window will appear with our WML deck loaded. Accessing Files through a Gateway Motorola produces and sells a WAP gateway, but they do not provide one for developer use on the Internet.You can find out more about the Developer Version of the Motorola WAP Gateway at www.motorola.com/wap. Ericsson realizes the value a public gateway provides to developers and has one available for developer use.We’ll connect to their gateway. Make sure the simulator is run- ning or you won’t be able to access the Simulator | Mobile Settings menu. If that option is grayed out, select Simulator | Run from the menu bar to start the simulator. Once you select the Simulator | Mobile Settings menu option, a dialog box with various options will appear.At the bottom in the WML Settings section, select the option that says Connect through WAP Gateway.A new section will appear at the bottom of the dialog box, as shown in Figure 5.20. Enter the IP address of 195.58.110.201 and port 9200, for connectionless mode to the WAP gateway.You can now access any server that is visible on the www.syngress.com Figure 5.20 Gateway Settings in the Motorola Mobile ADK 159_wi_wg_05 10/22/01 4:35 PM Page 207 208 Chapter 5 • Wireless Development Kits Internet just as you would when using HTTP direct mode, but the request will be proxied through the Ericsson WAP gateway first.The Mobile ADK has trouble testing local files while you have the WAP gateway set, so you will want to switch back to HTTP Direct mode for development and testing.This will probably be fixed before the final product is released. Debugging Techniques The Wireless IDE works like a programming language IDE. If you change the files in the project, you must compile the files again before running them in the simulator. If you do not, you will see the old version of the source, not the updated one.The Wireless IDE will warn you if files have been changed but not recompiled, but it is still easy to mistakenly test an old version of your WML file without realizing it.The safe way to use the Wireless IDE is to always compile the project before running the simulator. Let’s remove the close paragraph tag from our mobileADK.wml file so that it now contains the following markup: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd"> <wml> <card id="hello" title="Hello World"> <p>Hello World! </card> </wml> We can now select Project | Compile Project from the Wireless IDE menu to compile our file; the Wireless IDE will automatically save our changes before compilation.The pane where we saw a report that no errors were found now contains some error information.The error message is “c:\wml\mobileADK.wml(8): Error: syntax error.”This doesn’t help us debug our application very easily.The number in parentheses is the line number, which in our case is the end of the file.A syntax error is very general and could be any- thing from a misspelled tag to, in our case, a missing close tag. Luckily, we know where the error is, and we can insert the close paragraph tag to make the WML deck compile correctly again. You can open the invalid WML file in the simulator, but it will simply respond with an error message of “Syntax error in source. Open the file in the www.syngress.com 159_wi_wg_05 10/22/01 4:35 PM Page 208 Wireless Development Kits • Chapter 5 209 IDE and compile to find more information.”The Mobile ADK, despite its large download size, provides the least useful information during debugging compared to the others.This is unfortunate because the Wireless IDE is a very useful tool for creating, editing, and managing projects. The Ericsson Mobile Internet WapIDE 3.1 Ericsson has developed a software development kit that emulates their most pop- ular WAP-enabled phones.This SDK is supported and complemented by the Developer Zone Web site (www.ericsson.com/developerzone) and a multitude of developers from around the world who use it on a daily basis.The Ericsson WapIDE helps you build and test WAP applications.The WapIDE includes the following components: ■ Browser Simulates various Ericsson mobile phones with WAP services for testing.You can use it to demo WAP applications as well. ■ Application Designer Makes building and testing a WAP application easier by integrating a WML and WMLScript editor with an Ericsson mobile phone simulator. ■ Push Initiator Can send push messages to the simulator or an actual WAP terminal. This version of the WapIDE can simulate the Ericsson R320s, R380s, and R520m.You can develop WAP applications that use WAP 1.1 (R320s and R380s) and WAP 1.2 (R520m). Installing the Ericsson Mobile WapIDE The WapIDE is written in Java for the Win32 platform—this includes Windows 9x,Windows NT, and Windows 2000.The installation may require you to install additional software from Sun Microsystems if you do not have an appropriate Java Virtual Machine already installed on your computer. In the following sections, we cover the specific requirements for your system, how to obtain the software, and how to install the WapIDE on your computer. System Requirements for the Ericsson Mobile WapIDE Ericsson gives the following requirements for running the WapIDE: www.syngress.com 159_wi_wg_05 10/22/01 4:35 PM Page 209 210 Chapter 5 • Wireless Development Kits ■ Microsoft Windows 98,Windows NT 4.0, or Windows 2000 ■ Java2 Platform, version 1.3.0 or later. ■ Microsoft Internet Explorer 5, or later, is required to access local files and use the application designer. ■ 20MB of free disk space ■ Intel Pentium II 266 MHz (or faster) with 128MB of RAM (or better recommended for performance reasons) Ericsson does not explicitly state support for Windows Me, but we have suc- cessfully installed it and used it on that platform with no problems. Obtaining the Ericsson Mobile WapIDE You can download the Ericsson WapIDE from the Ericsson Developer Zone Web site at www.ericsson.com/developerzone.You are required to register before downloading the WapIDE.You can download other simulators from the Developer Zone Web site, including a dedicated R380 simulator and older ver- sions of the WapIDE. Installing the Ericsson Mobile WapIDE The file you download from Ericsson will be called WapIDE_31.exe. Run this application and you will be greeted with the initial install screen shown in Figure 5.21. www.syngress.com Figure 5.21 Initial Install Screen for the Ericsson WapIDE 159_wi_wg_05 10/22/01 4:35 PM Page 210 Wireless Development Kits • Chapter 5 211 Click Continue to begin installing the WapIDE.You will have to accept the License Agreement, view a ReadMe file, and then choose where you want the SDK installed.We chose the default installation location for simplicity.You can choose what Program Group to install the WapIDE into on the next screen.The final screen asks you to confirm your choices, and then the WapIDE is installed on your computer. Working with the Ericsson Mobile WapIDE We look at the Application Designer during these exercises because it integrates the browser into a development environment. If you installed the WapIDE in the default location, you can start the application from the Start menu by choosing Programs | Ericsson WapIDE 3.1 | Application Designer.The initial window may take some time to appear, this is normal.The initial window is shown in Figure 5.22. The WapIDE is a project-based environment.This means that you can group files together in a project and can reload them all at once into the WapIDE at a later time, saving yourself the effort of loading each file individually.The top-left www.syngress.com Figure 5.22 Initial Ericsson WapIDE Window 159_wi_wg_05 10/22/01 4:35 PM Page 211 . should be able to look at it in the simulator now. You can launch the current file in the simulator by selecting the Simulator | Run menu option in the Wireless IDE.A new simulator window will. change the files in the project, you must compile the files again before running them in the simulator. If you do not, you will see the old version of the source, not the updated one .The Wireless. click Next to continue. Choose the defaults for the installation directory and Program Group, and then the installer will copy the software to your machine. You cannot launch the Wireless IDE