Web Lec 16

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Aspire College Liaquat Pur Lecturer: M.

Ramzan

Web Technologies
BS IT (5th Semester)
WML | Introduction
WML stands for Wireless Markup Language (WML) which is based on HTML and HDML. It is
specified as an XML document type. It is a markup language used to develop websites for
mobile phones. While designing with WML, constraints of wireless devices such as small display
screens, limited memory, low bandwidth of transmission and small resources have to be
considered. WAP (Wireless Application Protocol) sites are different from normal HTML sites in
the fact that they are monochromatic (only black and white), concise and has very small screen
space, due to which content in the WAP sites will be only the significant matter, much like how
telegraph used to work in the olden days. The concept WML follows is that of a deck and card
metaphor. A WML document is thought of as made up of many cards. Just like how cards can
be grouped to form a deck, a WAP site has many cards. One card will be displayed at a time on
the screen, just like how one page is displayed at a time in an HTML website. Many cards can be
inserted into a WML document, and the WML deck is identified by a URL. To access the deck,
the user can navigate using the WML browser, which fetches the deck as required.
Features of WML:
Text and Images: WML gives a clue about how the text and images can be presented to the
user. The final presentation depends upon the user. Pictures need to be in WBMP format and
will be monochrome.
User Interaction: WML supports different elements for input like password entry, option
selector and text entry control. The user is free to choose inputs such as keys or voice.
Navigation: WML offers hyperlink navigation and browsing history.
Context Management: The state can be shared across different decks and can also be saved
between different decks.
Problems Faced by a Web Application When Used With a Mobile and Wireless Environment:
1. HTTP:
Bandwidth and delay: HTTP is not made for low bandwidth and high delay connections in mind.
HTTP protocol headers are large and redundant as HTTP is uncompressed and stateless.
Caching: Caching is disabled by content providers as client companies cannot get feedback if a
cache is placed between a server and a client. Users suffer from downloading the same content
repeatedly from the server as HTTP is stateless.

1
Aspire College Liaquat Pur Lecturer: M.Ramzan

Posting: Sending some content from a client to a server will create additional problems if the
said client is disconnected at that moment.
2. HTML: HTML was designed for use in creating content for webpages of the World Wide Web
(www). It was meant only for desktop initially. Thus, when used in hand-held devices, some
problems arise:
Small display and low-resolution.
Limited User Interfaces.
Low-Performance CPU.
Enhancements needed for use of HTML in wireless environments:
Image scaling
Content Transformation: Documents in PDF or PPS should be transformed into the plain text as
PDF occupies more memory.
Content Extraction: To avoid longer duration waits, some content like headlines can be
extracted from the document and presented to the user. This lets the user decide which
information alone needs to be downloaded.
Enhancements needed for use of HTTP in wireless environments:
Connection Re-use: Client and server can be used the same TCP (Transmission Control
Protocol) connection for several requests and responses. Pipelining can be used to improve
performance.
Caching Enhancements: A cache could store cacheable response to reduce response time and
bandwidth for further responses. Caching can be done in the mobile client’s web browser itself
by using a client proxy. A network proxy can also be used on the network side.
Bandwidth Optimization: HTTP supports compression and also negotiates the compression
parameters and compression styles. This will allow partial transmissions.
WML Script: WML Script is the client-side scripting language of WML in Wireless Application
Protocol(WAP) and whose content is static. It is similar to JavaScript. It is optimized for low
power devices and is a compiled language. Some of the standard libraries of WML Script are
Lang, Float, String, URL, WML Browser, Dialog, and WML Script Crypto Library.
Declaring A WML Document and Cards: To create a WML document, type it in notepad, just
like for HTML. The first line should be something like this:

<?xml version="1.0"?>

2
Aspire College Liaquat Pur Lecturer: M.Ramzan

<!DOCTYPE wml PUBLIC


"-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index"
title="My WAP Site Using WML"
newcontext="true">
</card>
</wml>

Which tells the phone that it is going to interpret a WML document and the WML standards. A
card with the ID contents (used for linking) will be generated and the output at the top of the
screen will be. It is extremely important to close all WML tags, unlike HTML tags. If you do not
close a WML tag, a card will not open at all. You have to close both the <card> and <wml> tags.
Example: The code below shows a sample WML coding for a small WAP site with two cards and
a link to an external website.

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<!-- This is first card-->


<card id="one" title="First Card">
<h1> Geeksforgeeks </h1>
<p>
A Computer Science Portal for Geeks
</p>

3
Aspire College Liaquat Pur Lecturer: M.Ramzan

</card>

<!-- This is second card-->


<card id="two" title="Second Card">
<p>
This is created by WML
</p>
</card>

</wml>

Output:

Comparison of WML with HTML:


WML is used only for WAP sites on mobile phones and can be hosted only be WAP hosts that
support WML. HTML can be hosted by any web server.
WML sites are monochrome, unlike HTML sites.
Coding is similar in many aspects but a badly coded WAP site will definitely not run as
compared to a badly coded HTML site.
It is must to close all WML tags as compared to the more lenient HTML coding.
There are no alignment tags like the <center> tag in WML, as in HTML. Instead, <p
align=”center”> has to be used for aligning text in WML.
There are problems when using old HTML tags like <br> which have no closing tag. To get
around this in WML, some tags have a “/” put on the end like <br />.
Only WBMP format monochrome images are supported in WML whereas there is no such
restriction in HTML.

4
Aspire College Liaquat Pur Lecturer: M.Ramzan

XSL | Introduction
Before learning XSLT, we should first understand XSL which stands for
EXtensible Stylesheet Language. It is similar to XML as CSS is to HTML.
Need for XSL
In case of HTML document, tags are predefined such as table, div, and span; and the browser
knows how to add style to them and display those using CSS styles. But in case of XML
documents, tags are not predefined. In order to understand and style an XML document, World
Wide Web Consortium (W3C) developed XSL which can act as XML based Stylesheet Language.
An XSL document specifies how a browser should render an XML document.
Following are the main parts of XSL −
XSLT − used to transform XML document into various other types of documents.
XPath − used to navigate XML document.
XSL-FO − used to format XML document.
What is XSLT
XSLT, Extensible Stylesheet Language Transformations, provides the ability to transform XML
data from one format to another automatically.
How XSLT Works
An XSLT stylesheet is used to define the transformation rules to be applied on the target XML
document. XSLT stylesheet is written in XML format. XSLT Processor takes the XSLT stylesheet
and applies the transformation rules on the target XML document and then it generates a
formatted document in the form of XML, HTML, or text format. This formatted document is
then utilized by XSLT formatter to generate the actual output which is to be displayed to the
end-user.

5
Aspire College Liaquat Pur Lecturer: M.Ramzan

Advantages
Here are the advantages of using XSLT −
Independent of programming. Transformations are written in a separate xsl file which is again
an XML document.
Output can be altered by simply modifying the transformations in xsl file. No need to change
any code. So Web designers can edit the stylesheet and can see the change in the output
quickly.

Web Services:
A Web Service is can be defined by following ways:

• It is a client-server application or application component for communication.


• The method of communication between two devices over the network.
• It is a software system for the interoperable machine to machine communication.
• It is a collection of standards or protocols for exchanging information between two
devices or application.

6
Aspire College Liaquat Pur Lecturer: M.Ramzan

Let's understand it by the figure given below:

As you can see in the figure, Java, .net, and PHP applications can communicate with other
applications through web service over the network. For example, the Java application can
interact with Java, .Net, and PHP applications. So web service is a language independent way of
communication.

Types of Web Services:


There are mainly two types of web services.

• SOAP web services.


• RESTful web services.

7
Aspire College Liaquat Pur Lecturer: M.Ramzan

Web Service Features:


XML-Based
Web services use XML at data description and data transportation layers. Using XML exclude
any networking, operating system, or platform binding. Web services-based operation is
extremely interoperable at their core level.
Loosely Coupled
A client of a web service is not fixed to the web service directly. The web service interface can
support innovation over time without negotiating the client's ability to communicate with the
service. A tightly coupled system means that the client and server logic are closely tied to one
another, indicating that if one interface changes, then another must be updated. Accepting a
loosely coupled architecture tends to make software systems more manageable and allows
more straightforward integration between various systems.
Coarse-Grained
Object-oriented technologies such as Java expose their functions through individual methods. A
specific process is too fine an operation to provide any suitable capability at a corporate level.
Building a Java program from scratch needed the creation of various fine-grained functions that
are then collected into a coarse-grained role that is consumed by either a client or another
service.
Businesses and the interfaces that they prove should be coarse-grained. Web services
technology implement a natural method of defining coarse-grained services that approach the
right amount of business logic.
Ability to be Synchronous or Asynchronous
Synchronicity specifies the binding of the client to the execution of the function. In synchronous
invocations, the client blocks and delays in completing its service before continuing.
Asynchronous operations grant a client to invoke a task and then execute other functions.
Asynchronous clients fetch their result at a later point in time, while synchronous clients
receive their effect when the service has completed. Asynchronous capability is an essential
method in enabling loosely coupled systems.
Supports Document Exchange
One of the essential benefits of XML is its generic way of representing not only data but also
complex documents. These documents can be as simple as describing a current address, or they
can be as involved as defining an entire book or Request for Quotation (RFQ). Web services
support the transparent transfer of documents to facilitate business integration.

You might also like