Enabling WMLScript in IIS

To execute a sample like this, you must enable Microsoft Internet Information Server (IIS) to serve WMLScript files. The same is true if you want to serve static WML files that have a .wml file extension (as distinct from WML created by a Mobile Internet Toolkit application). To do so, follow these steps:

1. In Control Panel double click Administrative Tools, and open Internet Services Manager, or Internet Information Services if you're running Microsoft Windows XP.

2. Right-click your Web server in the tree view, and click Properties. (In Windows XP, you'll need to navigate to the Web Sites item to get to properties.)

3. On the Internet Information Server tab, Click the Edit button in the Computer MIME Map section. (You'll find this button labeled File Types on the HTTP Headers tab in Windows XP.)

4. Click New Type: and type .wmls for the associated extension and text/vnd.wap.wmlscript for the content type (MIME). To serve static WML files, use the extension .wml and the MIME type text/vnd.wap.wml.

This application pulls together some of the features we've described in this chapter. In the FormLoad method, the HasCapability method of the MobileCapabilities object determines whether the requesting device supports WML version 1.1. If it doesn't, a form displaying an apology displays.

The Formi form uses standard mobile controls to accept input from the user. Then the <ContentTemplate> inserts WML code for a <do type="accept">, which renders as a softkey or another link with the legend "Convert". When selected, this calls the convert function in the WMLScript file called currency.wmls, which it fetches from the content server. The convert function takes arguments that are the values the user entered (the variables $SelectionListi, $SelectionList2, and $TextBoxi). Figure 8-19 shows the resulting WML markup.

Was this article helpful?

0 0

Post a comment