Miva, Miva Script, Miva Empresa, Miva Mia amd Miva Merchant are registered trademarks of the Miva Corporation
 
Ivo Truxa - truXoft control systems: advanced programming and custom IT solutions home / about / webdesign / Miva / automation / contact

http://mivo.truxoft.com
MIVO!
miva beyond limits

 

MIVA®  RESOURCES:  Miva and WAP / WML

by Ivo Truxa, 10/29/2000

  1. What is WAP and what is WML?
  2. Exporting WML pages with Miva
  3. Serving WAP/WML pages with a Miva engine
  4. Miva engine patch
  5. Links
  6. User Comments

What is WAP and what is WML?

WAP is Wireless Application Protocol and WML is Wireless Mark-up Language - HTML-like language for writing applications for WAP/WML enabled mobile phones and devices. Find more details in the links below or in any search engine.


top

Exporting WML pages with Miva

WML offers slightly better possibilities to write interactive pages than HTML. In some cases, it may be sufficient to create the content in Miva and export the results with MvEXPORT to a WML page. If you want to serve WML pages to WAP enabled devices, you should define a new handler and type in your Apache configuration (httpd.conf or .htaccess) as follows:

AddType text/vnd.wap.wml wml
AddHandler server-parsed wml

I use this method for example for displaying current exchange rates on a WML page. A Miva script grabs hourly the rate information from several official sites, stores it into a database and exports it properly formatted into a WML page. You can find a link to the WML page at http://truxoft.com/rates/ (Note: it is an old and simple WML page that I built in 1998 just to test the new technology).


top

Serving WAP/WML pages with a Miva engine

Current Miva versions (up to 3.72 to this date) do not allow modifying the HTTP header and therefore a direct serving of WAP/WML pages by the Miva engine is normally not possible. However, you can patch the Miva binary to force it serving other then default HTTP headers. Such change is permanent, it means that a patched Miva binary serves always just a single MIME type. You will need to keep the original binary (miva) and create a patched copy (e.g. miva-wml or miwa) for serving WAP/WML applications. You also need to add a new MIME type to your Apache configuration file (httpd.conf or .htaccess):

Action application/x-httpd-Miwa /cgi-bin/miwa
AddType application/x-httpd-Miwa wml

In this way you can write WML pages with all advantages of the interactivity of the Miva script together with WML tags.


top

Miva engine patch

Before patching the Miva engine you should read the usual disclaimer and be aware that I publish the information for educational use only. If you make the patch, do it on your own risk and in your responsability.

You will need to copy the Miva binary and open it in a hex editor. Search for the string 'text/html'. There are more instances, but just the one in the following context is important:

... %u %ld %lu %f text/html Cannot open configuration ...

You have to replace the text/html with text/vnd.wap.wml. The problem is that the new string is longer then the original one. In no case you may change the length of the file (inserting characters)! There are two possibilities:

  1. Try just text/wml, maybe it works too (I did not test it), but some devices could have problems receiving such header
  2. Overwrite the following string, but DO NOT forget to append a 0 character after text/vnd.wap.wml! I mean a character with ASCII value = 0 (string terminator), not a '0' character!

The following error message 'Cannot open configuration ...' will be messed up, but I believe it is not so terrible.


top

Some Useful Links

Phone.com Developer Web Site
Nokia WAP Toolkit
Ericsson Developers' Zone
List of several hex-editors
tiny (11kB) Hex editor (freeware) [cached]
Hackman hex editor (freeware)
HexWorkShop

 

top

   

Miva and some other terms used on this page are registerd trademarks of the Miva Corporation
copyright  truXoft  © 1997-2008