As technology changes, so do the tools that we use to manipulate it. Today the Internet is available from a number of devices, both connected and portable. In this article Jean shows us how to use the OpenWave SDK to create WML scripts. He also shows us how to configure IIS and Apache for WAP document requests.
Introduction to WAP using WML, ASP and PHP - Configuring IIS and Apache (Page 2 of 5 )
When a web server receives a request for a document, it will retrieve that documents MIME type and append it to the returned document as part of its header information. These MIME types can be configured, and both IIS and Apache facilitate adding new MIME types.
WML (Wireless Markup Language) files make up the bulk of WAP content, and are plain text files that use markup tags in a similar way to HTML and XML. They contain the .wml file extension, and before we can request a WMLScript from our web server, the server needs to know its MIME type.
Let's now look at adding the necessary MIME types for both Apache and IIS.
For Apache, you need to edit the httpd.conf file (which contains Apache's configuration directives) and add the following lines to the end of the file:
AddType text/vnd.wap.wml wml
AddType text/vnd.wap.wmlscript wmls
AddType application/vnd.wap.wmlc wmlc
AddType application/vnd.wap.wmlscriptc wmlsc
AddType image/vnd.wap.wbmp wbmp
The AddType directive tells Apache the details of the MIME types for files with specific extensions. The AddType directive is used like this:
AddType [MIME Type] [File Extension to map mime type to]
We've just added five new MIME types to Apache's httpd.conf file. If we now create a blank file called test.wml, then when we request this file through a WAP device, Apache will set the MIME type of that request to text/vnd.wap.wml, which indicates that the file contains WMLScript.
You'll need to restart Apache so that it recognizes our newly added MIME types.
Start the Microsoft Management Console (Start -> Run -> MMC) and load the IIS snap-in from the c:\winnt\system32\inetsrv\iis directory. Right click on the node that matches the name of your web server and choose the properties option.
Click on the edit button next to the master properties drop down box, select the HTTP Headers tab, and click on the file types button:
This will load the registered file types dialog. Click on the new type button and create five new file types using the list shown below:
Associated extension: wml
Content type: text/vnd.wap.wml
Associated extension: wmls
Content type: text/vnd.wap.wmlscript
Associated extension: wmlc
Content type: application/vnd.wap.wmlc
Associated extension: wmlsc
Content type: application/vnd.wap.wmlscriptc
Associated extension: wbmp
Content type: image/vnd.wap.wbmp
Click OK three times to close all of the open dialogs, and then close MMC itself. You will need to restart IIS so that it picks up our newly added MIME types.
[Note] We don't have to set the MIME types for WAP content in IIS/Apache, and we can add the details of the MIME type manually to a script using by modifying its header information. [End Note]
Now that our Apache/IIS web server is ready to handle requests for WAP content, let's create a simple "hello world" script using WML and WMLScript.