Tuesday, June 26, 2007

Having problems on your first WAP website?

So you put a lot of effort and created a WML based version of your website and have tested it thoroughly with all the great WAP tools and simulators. Now you take your tentative first step and try to access it using a WAP browser on your GPRS phone and you get "Invalid content type"!
Hmmmm. So what went wrong?
Two possibilities:
1) Content-Type set in HTTP response is actually incorrect. It should be:
Content-Type: text/vnd.wap.wml
Note: Above content-type is only for wml pages. Now-a-days many phone browsers support direct HTTP and html pages in which case content-type would be text/html

How to find what Content-Type is being received by the browser? Use a tool like Openwave phone simulator which also display complete dump of http protocol between client and server. It's available at Openwave Phone Simulator
Advantage over some of the other tools is that it can directly handle http and does not require a WAP gateway (simulator) to function.


2) But problem may not be that simple. Second thing to check is actual WML page generated. You would wonder how could that be a problem since I tested with my great XYZ wap phone simulator. But here's the rub, most WAP phone simulators are very lax in wml parsing. They allow you to get away with murder while real WAP browsers on phone and WAP gateways are very strict in content parsing. On top of that error you get on a phone browser would not be very illuminating. You might get "Invalid content type" for both incorrect setting of Content-Type header in HTTP response and also when for some syntax error in the wml page.
The best way to catch these type of errors is to validate your WML and that's very easy to do. Just head to W3C Validator and enter your web site's URL.

Hope this helps some newbies out there who are facing the same problem as I did.

Thanks Thyaga for starting me on!

No comments: