Tuesday, December 24, 2013

B.Sc. IT BT0087 (Semester 5, WML and WAP Programming) Assignment

Fall 2013 Assignment
Bachelor of Science in Information Technology (BSc IT) – Semester 5
BT0087 – WML and WAP Programming – 2 Credits
(Book ID: B1182)
Assignment Set (30 Marks)

1.      Write short note on WAP toolkit software.
Ans.-   The WAP Toolkit simulates a generic WAP mobile phone (you can choose from two models), later referred to as user agent. A WAP user agent is similar to a web browser with the distinction that in the WAP environment Uniform Resources Locators (URLs) are requested is sent to a web server via a WAP Gateway. The web server (also called an "origin server" because content originates with it) contains WML and WML Script content.
Having received the request for this content, the web server sends it to the WAP Gateway, which encodes it into binary form (to reduce its size). The WAP Gateway then transmits the encoded content to the requesting mobile phone. The content received by the phone is optimized for small displays.
WML is based on the Extensible Markup Language (XML) and was developed by the Wireless Application Protocol (WAP) Forum for specifying content and the user interface for narrow and devices such as mobile phones.
WML Script can be used to add client side procedural logic to WML cards and decks. The language is based on ECMA Script, but has been modified to better support low band with devices such as mobile phones. You can use WML Script along with WML to provide intelligence to the client, or you can use it as a stand-alone tool.
The WAP toolkit provides tools for creating services on the WAP platform. It includes the following components:
·         The WAP Toolkit application for Windows NT 4.0, Windows 95, and Windows 98, which simulates the behavior of WML and WML script, allows you to create, edit and debug WML and WML Script services.

The simulation client includes the following components:
– WML Script interpreter and WML Script libraries
– WAP phone simulations
– WML and WML Script encoders Compiled
– WML, WML Script, and WBMP editors
– WAP Protocol Stack, HTTP and file access modules
– Debugging views
– WAP Server Simulator for devices that require a connection to a WAP Gateway
– WAP Push Simulator. (Blueprint phone simulation only)

An installation utility and practical WML example applications and source code. You can use these samples as a starting point for creating your own services.
·         XML library that you can use to construct valid WML documents for use by server-side components, or for general use. The library only allows you to create valid content as validated by the standard DTD for WML 1.1.
·         User documentation in Adobe PDF format, this guide, a Developer's Guide, and a Designer's Guide.
The components of the WAP Toolkit software can be divided into three main categories discussed below:

Phone simulations
The phone simulations are on-screen images of phones that have functional displays and keys for navigating and entering data. There are two phone simulations: a simulation of the actual 7110 phone and a Java-based Blueprint phone simulation, which has no real-world counterpart.

Editors
The toolkit provides editors for convenience in developing WAP applications. There are four editors a WML Deck editor, a WML Script editor, a Push Message editor, and a WBMP graphics editor. The editor interface also provides an easy means to compile the textual source code into binary data for display on the phone simulation.

Debugging aids
The Toolkit provides several tab views with in its main window. Some of these views are used for editing, while others provide information for debugging. These latter views include the history view, sessions view, and variables view.

2.      What is WML input field? Explain WML password input field.
Ans.-   WML Input Fields
Input fields are used to obtain alphanumeric data from users. The <input/> tag is used to create input fields. Let's first take a look at the following WML example. Then we will mention about some of the commonly used attributes of the <input> element.

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
<wml>
  <card id="card1" title="WML Input Fields">
    <p>
      Hello, welcome to our WML tutorial.<br/>
      What's your name?
      <input name="myname" maxlength="16"/>
    </p>
  </card>
</wml>

Figure shows the result of the above WML example.


Like a selection list, an input field is associated with a variable, which stores the data entered by the user. The variable name is specified with the name attribute of the <input> element. In the above WML example, a variable myname is associated with the input field. If you enter Tom in the input field, the variable myname will contain the valueTom
The maxlength attribute of the <input> element limits the number of characters that a user can enter in an input field. In the above WML example, a user can enter at most 16 characters in the input field.
In the above WML example, we have not set a default value to the input field. So, as you can see in the screenshots, the input field is empty at the beginning. If you want to set a default value to the input field, you need to specify the value attribute in the <input> element. For example, if we change the following line:

<input name="myname" maxlength="16"/>
to: 
<input name="name" maxlength="16" value="Jack"/>
Then the input field will contain the word "Jack" by default.

WML Password Input Fields
The type attribute is another useful attribute of the <input> element. Its value can be either text (default value) or password. If the value of the type attribute is text, the characters in the input field will be visible; if you change it to password, all characters in the input field will be displayed as asterisks (*). Note that data in password input fields will not be transmitted in a more secure way than that in ordinary input fields. The following WML example demonstrates how to create a password input field:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
<wml>
  <card id="card1" title="Password Input Fields">
    <p>
      Please login before reading our WML tutorial.<br/><br/>
      User Name:
      <input type="text" name="name" maxlength="16" value="Jack"/><br/>
      Password:
      <input type="password" name="passwd" maxlength="10" value="abc"/>
    </p>
  </card>
</wml>

The result of the above WML example in WAP browsers is shown in figure.



3.      Explain Naming convention for WML Scripts and Characteristics of the functions in WML scripts.
Ans.-   1. Naming convention for WMLScripts
In WMLScript, function names must be started with a letter or an underscore character. The rest of the characters can be letters, numbers, or underscores. Special characters other than the underscore are not permitted. You cannot use WMLScript reserved words and keywords as function names. Remember that WMLScript is case-sensitive. The names wmlscript_function and WMLScript_Function refer to two different functions.
Here are some examples of valid function names:
·         wmlscriptFunction
·         _wmlscript_function
·         wmlscript_function1
·         wmlscript_1st_function
·         WMLSCRIPT_FUNCTION

And, here are some examples of invalid function names:
·         1st_wmlscript_function (Reason: you cannot start a function name with a number)
·         11111 (Reason: You cannot start a function name with a number)
·         wmlscript-function (Reason: The - character is not permitted)
·         ~wmlscript_function (Reason: The ~ character is not permitted)

2. Characteristics of the functions
The characteristics of the functions in WML Script are mentioned below
·         Function declarations cannot be nested.
·         Function names must be unique within one compilation unit.
·         All parameters to functions are passed by value.
·         Function calls must pass exactly the same number of arguments to the called function as specified in the function declaration.
·         Function parameters behave like local variables that have been initialized before the function body (block of statements) is executed.
·         A function always returns a value. By default, it is an empty string (" ").
·         However, you can use a return statement to specify other return values.
A function in WMLScript is defined using the following format. The parts enclosed inside brackets [] are optional.

[extern] function function_name ([argument1, argument2...])
{
  WMLScript statements here
  [return (some_value);]
}

The extern keyword
The extern keyword is used to specify that a function can be called from both inside and outside of the WMLScript file, i.e. the function can be called from functions in the same WMLScript file, from functions in a different WMLScript file, or in a WML file. If you define a function without the extern keyword, the function can only be called from functions in the same WMLScript file.

WMLScript function Arguments
Arguments are used to pass values into a function. Unlike programming languages like C++ or Java, WMLScript does not require you to specify the data type of an argument. For example, to pass two numbers into the WMLScript function wmlscript_function(), you will define something like this:
function wmlscript_function (number1, number2)
{
...
}
If a function does not require any arguments, you still need to include the parentheses (), like this:

function wmlscript_function ()
{
...
}

The return statement
The "return (some_value);" statement is used to return a value back to the calling function in WMLScript. For example, the calculateSum() function below returns the sum of two numbers back to the calling function each time it is executed:
function calculateSum(number1, number2)
{
  return (number1 + number2);
}
The wmlscript_function() function below calls calculateSum() with two arguments 1 and 2. The value 3 is returned from calculateSum() and is assigned to the sum variable:
function wmlscript_function()
{
 ... sum = calculateSum(1, 2);
 ...
 }
It is not compulsory to include a return statement in a WMLScript function. If no return statement is included, the default.


For More Assignments Click Here

No comments:

Post a Comment