182 Chapter 5 • Wireless Development Kits Openwave does not claim any memory requirements either, but we have found that you should have at least 64MB of memory. Obtaining the Openwave UP.SDK You can download the UP.SDK from the Openwave Developer Program Web site at http://developer.openwave.com in the Downloads section.You are not required to register in order to download the UP.SDK, but you are required to register if you wish to test through the UP.Link gateway that they provide on the Internet.Also on the Web site are directions for signing up and provisioning the UP.Link gateway for testing. You can download various emulator skins to simulate testing on multiple devices.The term skins is a bit misleading, actually, because the browser will not only inherit the look of the device but also the behavior.This is useful for checking the navigation and appearance of your application on multiple devices in a rapid manner.The skins are downloadable from the same location as the UP.SDK. Installing the Openwave UP.SDK When you download the UP.SDK from the Openwave Web site, you will down- load a file called upsdkW41e.exe. Run this application, and you will be greeted with the initial install screen shown in Figure 5.1. www.syngress.com Figure 5.1 The UP.SDK Initial Install Screen 159_wi_wg_05 10/22/01 4:35 PM Page 182 Wireless Development Kits • Chapter 5 183 Click Next to continue.You will have to click Ye s to agree to the Software License Agreement as well as the Screenshots and Image Use Agreement.You will also have to verify that you are not residing in a country that the United States currently has an export embargo against (a peculiar requirement for a WapIDE!). The installation program then asks you where you would like to install the UP.SDK on your computer and what program group you would like to set up for your Start menu.You can accept the defaults for this or specify another loca- tion.The installer then copies the software to your system, and the final install screen gives you the option of viewing the ReadMe file and starting the UP.Simulator. Choose the option to start the UP.Simulator and click Finish. Working with the Openwave UP.SDK When you first launch the UP.Simulator, you will see two screens, as shown in Figure 5.2. The Phone Information screen provides you with details about what the UP.Simulator is doing. Shown here are the URLs that you are trying to access as well as information about the currently loaded WML Deck.This is information that is usually not critical to your application, but useful to know if, for example, www.syngress.com Figure 5.2 The UP.Simulator 159_wi_wg_05 10/22/01 4:35 PM Page 183 184 Chapter 5 • Wireless Development Kits you are debugging a problem or curious about the compiled size of your WML. You may want to work with the Phone Information window minimized so that you look at it only when you run into problems. The emulator window shows a picture of the selected device and will be the window you use to interact with the application. Accessing and Editing Local Files This version of the UP.SDK requires you to type in every WML deck you would like to access in the address bar located at the top of the emulator window.To access local files, use the syntax file://c:\wap\hello.wml and normal HTTP URLs to access decks on a Web server such as http://127.0.0.1/hello.wml. Let’s save the following WML file as a simple Hello World page called hello.wml in the c:\wap directory: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"> <wml> <card id="hello" title="Hello World"> <p>Hello World!</p> </card> </wml> The emulator window with our example file is shown in Figure 5.3. In most cases, you can use the keyboard to enter information into the emu- lator instead of using the graphical keypad. However, use the keypad to verify that input formatting restrictions and other GUI features work as you expect. NOTE The UP.SDK does not provide a mechanism for editing files. You must use an editor such as TextPad or Emacs to create and change your WML files. The advantage of Openwave’s approach is that you do not have to learn a new editor just to write WML applications. The disadvantage is that your favorite editor may not have the WML-specific editing features that make developing WAP applications easier. www.syngress.com 159_wi_wg_05 10/22/01 4:35 PM Page 184 Wireless Development Kits • Chapter 5 185 The Phone Information window will show you the uncompiled and com- piled size of the WML file you access.The Phone Information window also shows you caching information; because wireless networks are low bandwidth, every effort to cache files is made.This may become a problem when you are developing an application that is constantly updating with new information, such as a game.WAP provides mechanisms for telling gateways and browsers how long to cache information, but it may not behave as expected in all cases.This is a good way to ensure that your page is caching only your page for the duration you specify. Figure 5.4 shows the Phone Information window after we have loaded our example page. www.syngress.com Figure 5.3 The UP.Simulator Figure 5.4 Information About the Current WML Deck 159_wi_wg_05 10/22/01 4:35 PM Page 185 186 Chapter 5 • Wireless Development Kits Accessing Files through a Gateway Openwave provides access to a UP.Link gateway free of charge for developers.You are required to sign up for the Openwave Developer Program in order to access this service.You can sign up at the Openwave Developer Program Web site by clicking the WAP Gateway button along the top navigation bar or the UP.Link Provisioning link along the left navigation bar.You will be prompted to sign up if you are not a member. Once you log in, you can add, delete, or edit users that are allowed to access the UP.Link gateway. Follow the directions on the Openwave Web site to manage your users and gain access to the UP.Link gateway. You need to change the settings in your UP.Simulator to use the UP.Link you have just set up. From the emulator window, select Settings | UP.Link Settings from the menu bar.You will then be able to select either a direct HTTP connection, or to use one of the gateways specified.The gateways are all prefilled with the names of the Openwave gateway servers, so all you have to do is click the radio button as shown in Figure 5.5 and click OK to start using the gateway. Once you are using the gateway, you cannot access local files anymore; the simulator will attempt to contact the gateway first and have it deliver the file.You can access only servers that are not blocked by firewalls.You must run a Web server that is accessible by the outside world to test your WAP application using a gateway. Other than that, the simulator acts as it did before, but it proxies all of its requests through the UP.Link gateway. www.syngress.com Figure 5.5 UP.Simulator Gateway Setup Screen 159_wi_wg_05 10/22/01 4:35 PM Page 186 Wireless Development Kits • Chapter 5 187 Debugging Techniques As described earlier, the UP.SDK provides a Phone Information console window that provides great information for the developer of a WAP application.This window gives you information that helps you track down the source of any problem. Figure 5.6 illustrates this with our hello.wml file from which we have removed the close paragraph tag (</p>). Unfortunately, the error message isn’t as descriptive as “No close tag for <p> tag opened on line 6,” but it does help you find the problem.The phone emulator window simply tells you to look in the Phone Information window because a compilation error occurred.You will also notice in Figure 5.6 that the file was not found in the cache.We had a compilation error, so the UP.Simulator will look for the file on the disk again, but if we load the hello.wml file from the previous example again, we notice that it finds the file in the cache.This is indicated by the text “cache hit: file://c:\wap\hello.wml” in the Phone Information window. The UP.SDK will not reload the WML deck from the server unless you first clear the cache by selecting Edit | Clear Cache from the emulator window menu bar.You can now reload the hello.wml file and get the compiled size and other information from the Phone Information window. www.syngress.com Figure 5.6 The Phone Information Window after Loading an Invalid WML File 159_wi_wg_05 10/22/01 4:35 PM Page 187 188 Chapter 5 • Wireless Development Kits The Info menu allows you to view information about the status of the UP.Simulator.You can find out what cookies have been set, what documents are in the cache, the source of the current WML deck, and other information. WARNING The use of cookies is not always supported in WAP browsers, and even if it is supported, it may not always be available. The UP.Browser, for instance, relies on a UP.Gateway being used for cookie support. You may want to investigate, using URL rewriting to insert user information into links or some other technique for tracking users on your mobile site to avoid these incompatibilities. The Nokia WAP Toolkit 2.1 Nokia is the largest mobile handset manufacturer in the world, so a large per- centage of your WAP site visitors will be using Nokia phones.The Nokia WAP Toolkit can simulate WAP-enabled Nokia phones as well as a prototype phone that implements features not yet available on consumer handsets.The Nokia WAP Toolkit is an environment for developing, viewing, and testing WAP applications. It includes many features that will make your mobile development easier, such as the following: ■ Editing, validating, and viewing WML decks ■ Editing and debugging WMLScript files ■ Viewing and changing WML variables inside the WAP browser ■ Examining debug messages from the WAP browser ■ Creating and editing WBMP images The Nokia WAP Toolkit is a complete development environment, but you can use any editor of your choice and merely use the Toolkit to view and debug your applications.You can use the Nokia WAP Toolkit to simulate Nokia phone models 6210 and 7110 after you download additional modules from the Forum Web site.You can only develop WAP 1.2 applications using the Nokia Blueprint phone, a concept phone that comes with the toolkit.WAP 1.3 is not supported at this time.The SDK includes an editor for WML,WMLScript, and Wireless Bitmap (WBMP) image files. www.syngress.com 159_wi_wg_05 10/22/01 4:35 PM Page 188 Wireless Development Kits • Chapter 5 189 Installing Nokia’s WAP Toolkit The Nokia WAP Toolkit 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 appro- priate Java Virtual Machine (JVM) already installed on your computer. In the fol- lowing sections, we cover the specific requirements for your system, how to obtain the software, and how to install the Nokia WAP Toolkit on your computer. System Requirements for the Nokia WAP Toolkit Nokia gives the following requirements for running the WAP Toolkit: ■ Java Runtime Environment (JRE) version 1.3. If you do not have the JRE installed, the setup program will install it for you automatically. ■ Adobe Acrobat Reader for Online Help and User Documentation. ■ A Pentium II 266 MHz (or faster), 128MB RAM (256MB recom- mended),Windows NT 4.0 with SP3 or Windows 98 or Windows 2000, 16-bit color, 1024x768 resolution, 20MB of hard disk space. www.syngress.com Supporting Multiple Versions of WML The browser in a mobile phone cannot be easily upgraded, and some- times it cannot be upgraded at all. Because of this, your WAP site will most likely need to support multiple versions of the WML standard. The advantage to you is the ability to determine what browsers people will be using based on the devices that are most prominent in the market- place. The disadvantage is that you cannot tell your users to upgrade to the latest browser in order to view your site—they are stuck with that browser until they purchase a new mobile phone. Requiring a certain version of WML will cause your site to be unviewable by users with devices that do not support that particular ver- sion. By doing so, you will lose customers before ever getting a chance to make a first impression. Developing & Deploying… 159_wi_wg_05 10/22/01 4:35 PM Page 189 190 Chapter 5 • Wireless Development Kits Nokia does not state support for Windows Me, but we have installed and run the toolkit successfully on Windows Me.The memory requirements might seem high, especially coming from an embedded device manufacturer, but the WAP Toolkit’s performance is noticeably better with more memory. Obtaining the Nokia WAP Toolkit You can download the Nokia WAP Toolkit from the Forum Nokia Web site at http://forum.nokia.com.You have to register to download the WAP Toolkit, but registering allows you to download the SDK free of charge. You can download a variety of other tools for WAP and other technologies from the Forum Nokia Web site.The Nokia Activ Server is a WAP gateway/Web server that you can use to develop, test, and deploy WAP applications.You also gain access to developer discussions and documentation on Nokia products. Installing the Nokia WAP Toolkit The file you download from Forum Nokia is called NokiaToolkit2_1.zip. It con- tains the setup.exe program as well as the license agreement and release notes.You must unzip this file to run the setup program.You can use any program that can handle zip archives, such as Aladdin Expander (www.aladdinsys.com/expander) or WinZip (www.winzip.com). Once you unpack the zip archive, run the setup.exe program.You will be greeted with the initial install screen shown in Figure 5.7. www.syngress.com Figure 5.7 The Nokia WAP Toolkit Initial Install Screen 159_wi_wg_05 10/22/01 4:35 PM Page 190 Wireless Development Kits • Chapter 5 191 Click Next to continue with the installation.You then have to accept the terms of the license agreement by clicking Ye s .You are now presented with the choice of where to install the program; it is safe to accept the default location. The next screen, shown in Figure 5.8, lets you choose what components of the Nokia WAP Toolkit you want to install. The Basic Toolkit is required; you cannot uncheck it.The second component is the WAP Server Simulation, which allows you to test applications locally when you do not have access to a WAP gateway. If you do not install this component, you must have access to a WAP gateway in order to use the toolkit. Unless you are extremely cramped for disk space, do install the WAP Server Simulation because it makes prototyping and development much easier. Choose what Program Group to install the Toolkit into and confirm all your decisions.The setup program will finish the installation, and you can then use the Nokia WAP Toolkit. Working with the Nokia WAP Toolkit If you installed using the defaults, you can launch the Nokia WAP Toolkit by selecting Programs | Nokia WAP Toolkit | WAP Toolkit from the Start menu.You will see a splash screen while the application loads and then the initial window, shown in Figure 5.9, will appear. The window on the left is where you will do most of your work—it includes the WBMP editor,WML and WMLScript source editors, and various debugging facilities.The window on the right is the phone emulator where you will view your application and enter information using the phone interface. www.syngress.com Figure 5.8 Nokia WAP Toolkit Install Options 159_wi_wg_05 10/22/01 4:35 PM Page 191 . another loca- tion .The installer then copies the software to your system, and the final install screen gives you the option of viewing the ReadMe file and starting the UP.Simulator. Choose the. Program Group to install the Toolkit into and confirm all your decisions .The setup program will finish the installation, and you can then use the Nokia WAP Toolkit. Working with the Nokia WAP Toolkit If. have to register to download the WAP Toolkit, but registering allows you to download the SDK free of charge. You can download a variety of other tools for WAP and other technologies from the Forum