Monday, August 25, 2008

Introduction To WAP




Introduction:
Through this topic we will work together to understand Technology of Wireless Application Protocol (WAP), also we will take a fast tour about developing WAP Applications using ASP.net.

Technology Description:

Mobile Application :
When First Mobile arrived, it was only smart way for sending and receiving voice calls and after sometime for sending and receiving text messages. But now, it is become the most growing market for services and recreational purposes. It is also being used for accessing internet and multimedia world.

For this reason, a lot of developing and programming concepts changed to become compatible with mobile world, one of these concepts was WAP as a mobile alternative of WEB concepts for regular computers.

What is WAP ؟

From Wikipedia, WAP is an open international standard for application layer network communications in a wireless communication environment. Its main use is to enable access to the Internet (HTTP) from a mobile phone or PDA.

How it Work ؟

The Biggest different between WAP and WEB is that WAP able to work through less capabilities and slow speed in comapre with the configuration of regular computers.

WAP starts since an order come from mobile customer, it is convert HTML page to WML pages that is able to browsing through mobiles.

What is WML ؟

It is description language very similar to HTML tags, it have only some few different:

- The main Tag is <wml> instead of <html>.

- Documents splits to <card></cards>.


Introduction To WML:

This is sample from Wiki about WML document:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"http://www.phone.com/dtd/wml11.dtd" >
<wml>
<card id="main" title="First Card">
<p mode="wrap">This is a sample WML page.</p>
</card>
</wml>

Reading and Writing Variables in WML:

<setvar name="First_Name" value="Ahmed"/>
<setvar name="Age" value="21"/>

Later you can display it like that:

<p>First Name: $(First_Name)</p>

You can also read textbox value with the same way:

<card id="card1" title="Tutorial">
<do type="accept" label="Answer">
<go href="#card2"/>
</do>
<p>
<select name="name">
<option value="HTML">HTML Tutorial</option>
<option value="XML">XML Tutorial</option>
<option value="WAP">WAP Tutorial</option>
</select>
</p>
</card>
<card id="card2" title="Answer">
<p>
You selected: $(name)
</p>
</card>
</wml>

ASP.net Application using WAP:

Do you remember our first WAP Application in this topic?

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"http://www.phone.com/dtd/wml11.dtd" >
<wml>
<card id="main" title="First Card">
<p mode="wrap">This is a sample WML page.</p>
</card>
</wml>

If you want to use it through ASP.net, you have to convert it to something like that:

<%@ Page Inherits="System.Mobile.UI.MobilePage" Language="C#" %>
<%@ Register TagPrefix="mobile" Namespace="System.Mobile.UI" %>
<mobile:Form runat="server">
<mobile:Label runat="server">
This is a sample WML page.
</mobile:Label>
</Mobile:Form>

If you want to work through VB.net instead of C#, just modify the first line like that:

<%@ Page Inherits="System.Mobile.UI.MobilePage" Language="C#" %>


And now, if your web site ordered from PC, the response will contain HTML tags, if it is ordered from Mobile, the response will contains WML tags.



0 comments:

Post a Comment