Introduction To App. Web
Introduction To App. Web
Source:
Building Web Applications with UML Second Edition By Jim Conallen
Conallen,, 2002
Modeling Web Application Architecture with UML By:: Jim Conallen, 1999
IF3037
STEI ITB - 2008
Web App
Client site management
Cookies, sessions
Enabling technology
CGI, compiled modules, interpreted scripts
Dynamic clients
Script, java applet, activeX/COM
Distributed object
Java RMI, Microsoft DCOM
XML
Web services
@
Web applications evolved from Web sites or
Web systems
Web application is a Web system that allows its
users to execute business logic with a Web
browser
Web applications use enabling technologies to
make their content dynamic and to allow users
of the system to affect business logic on the
server.
@
R
@
It contains the same principal components of a
Web site:
a Web server,
a network connection, and
client browsers.
Web applications also include an application
server..
server
The addition of the application server enables the
system to manage business logic and state.
@
=
One common challenge of Web applications is
managing client state on the server.
Owing to the connectionless nature of client and server
communications, a server doesn't have an easy way to keep
track of each client request and to associate it with the
previous request, since each and every Web page request
establishes and breaks a completely new set of connections.
Managing state is important for many applications; a
single use case scenario often involves navigating
through a number of Web pages.
The W3C has proposed an HTTP state management
mechanism, more commonly known as "cookies
"cookies""
@
=
A cookie is a piece of data that a Web server can
ask a Web browser to hold on to, and to return
every time the browser makes a subsequent
request for an HTTP resource to that server.
Typically, the size of the data is small, between
100 and 1K bytes; however, the official limit is
around 4K.
@
A session represents a single cohesive use of the system.
A session usually involves many executable Web pages and a lot
of interaction with the business logic on the application server.
The most common example of keeping client state on the server
can be found on the Internet at any e-
e-commerce site.
The use of virtual shopping carts is a nice feature of an online store.
A shopping cart contains all the items an online customer has selected
from the store's catalog.
The shopper can check the contents of the cart at any time during the
session.
This feature requires that the server be capable of maintaining some state
about the client across a series of Web page requests.
@
ë
Enabling technologies are the mechanism by which
Web pages become dynamic and respond to user input.
The earliest involved the execution of a separate
module by a Web server.
Instead of requesting an HTML-
HTML-formatted page from the file
system, the browsers would request the module, which the
Web server interpreted as a request to load and to run the
module.
The module's output is usually a properly formatted HTML
page but could be image, audio, video, or other data.
@
ë
The original mechanism for processing user input in a Web system is the
Common Gateway Interface (CGI),
a standard way to allow Web users to execute applications on the server.
can be written in any language and can even be scripted.
the most common language for small-
small-scale CGI modules is Perl (practical
extraction and reporting language), which is interpreted each time it is executed.
The two biggest problems with CGI:
it doesn't automatically provide session management services
every execution of the CGI module requires a new and separate process on the
application/Web server
The available solutions:
by adding plug-
plug-ins to the Web server.
the plug-
plug-ins allow the Web server to concentrate on servicing standard HTTP
requests and deferring executable pages to another running process
@
ë
Two major approaches to Web application²
application²enabling
technologies are used today:
compiled modules
interpreted scripts
=
are CGI-
=
CGI-like modules that are
compiled loadable binaries executed by the Web server.
These modules have access to APIs that provide the information
submitted by the request, including the values and names of all the fields
in the form and the parameters on the URL.
These modules produce HTML output that is sent to the requesting
browser.
Some popular implementations of this approach are Microsoft's Internet
Server API (ISAPI), Netscape Server API (NSAPI), and Java servlets.
@
ë
looks like an
HTML page that happens to process business
logic (whereas the compiled-
compiled-module solution looks like a
business logic program that output HTML)
a file in the Web server's file system, contains scripts
to be interpreted by the server;
the scripts interact with objects on the server and
ultimately produce HTML output.
some popular vendor are Java Server Pages,
Microsoft's Active Server Pages, and PHP.
@
ë
@
Ñ =
Client computers that sharing in the execution of the
business logic
The simplest examples: field and form validations
A number of technologies and mechanisms share some
features:
associated with the Web page and can access and modify its
content.
automatically deployed, or downloaded, to the client
computer as needed.
address specific security concerns.
@
Ñ =
JavaScript is the most common scripting technology in browsers
today
one part of the Java technology revolution; an implementation of a
scripting language that has its roots in the Java programming language
easier to learn and to use than Java
JavaScript comes embedded in HTML pages, so it needs to
coexist in the document
The <script> and </script> tags, used to define regions of JavaScript.
Examples:
<SCRIPT LANGUAGE="JavaScript"> alert('Hello World.') </SCRIPT>
Not all browsers are JavaScript capable
even though a browser is built to be robust and fault tolerant, the earliest
browsers do not gracefully handle JavaScript
@
Ñ =
!
The use of Java on the client is usually in the form of an applet
An applet are:
more or less a user interface control that is placed in a Web page
made up of both system and custom classes
A custom applet extends, or inherits, from the Java applet class.
Applets are referenced by a Web page
need to be identified by a tag: <object> to identify:
the type of object (Java),
the name of the class file to load and run, and,
optionally, the location, or URL, where the file or files can be found on the network.
Examples:
<OBJECT codetype="application/java" classid="java:Bubbles.class"
codebase="http://www.wae--uml.org/javaclasses/"> Java applet that draws
codebase="http://www.wae
animated bubbles. </OBJECT>
@
Ñ =
"#=
ActiveX is used to extend client-
client-side functionality in much the same way as
Java applets do
ActiveX is built on Microsoft's Component Object Model (COM)
COM is an infrastructure in which developers can build components, each in the
language of its choice, and share these objects to build bigger, more complex
systems
ActiveX is simply the brand name associated with a subset of COM technologies
ActiveX and COM can be used interchangeably
ActiveX object must be installed on the computer that it is to run on
Installing an ActiveX object typically means copying the DLL (dynamic link
library), EXE, or OCX file to the local hard drive and adding a few entries to the
registry
Because ActiveX objects often have dependencies on other ActiveX objects or
DLLs, these too need to be installed on the computer
ActiveX controls are placed in an HTML page with the <object> tag.
@
Ñ
$
Using distributed objects in a Web application can solve a lot of functionality
and performance issues in Web application development
The key is to incorporate the distributed object system without losing the
main benefits of a Web architecture
The most notable benefit of the Web is its ease of deployment.
To make effective use of distributed objects, there must be a way to
automatically send to the client the objects and interfaces necessary for it to
participate in the system without having the user stop the application and
install special software.
Two principal distributed object infrastructures: Java's RMI and Microsoft's
DCOM.
The goal of both is to hide the details of distributed communications and make
them the responsibility of the infrastructure, not of the class designer or the
implementer
They work on the principle of location transparency,
transparency, which states that the object
designer/implementer should never need to know the location of a given object
instance
@
[|#||
The Java standard for distributed objects
Allows Java classes to communicate with other Java classes,
which might be located on different machines
Java RMI is a set of APIs and a model for distributed objects
that allows developers to build distributed systems easily
The initial release of the RMI API used Java serialization and the
Java Remote Method Protocol (JRMP) to make method
invocations across a network look like local invocations
Today, the use of Internet Inter-
Inter-Orb Protocol (IIOP) as the
transport protocol is preferred, making it easier to integrate with
non--Java objects
non
a product of the CORBA initiatives
built--in support for this protocol is included in the latest releases of the
built
Java Development Kit (JDK)
@
[|%
@
[|%
Introduces two new types of object: stub and skeleton.
The stub is a client-
client-side object that represents the remote object
and executes on the client machine
The skeleton is responsible for managing all the details of being
remote³
remote ³responding to communications from objects on
another machine³
machine³and exists on the server machine
You don't have to write the code for them yourself
Automatically generated from a special compiler: rmic
This compiler creates the stub and skeleton classes from business objects
that implement certain interfaces
For example, the rmic command would take the Java class MyObject as
an argument and produce class files of the form MyObject_Skel.class and
MyObject_Stub.class
@
[|
RMI is typically used as a communication mechanism
between an applet and an application server
The applet is part of a Web page
require a Java-
Java-enabled Web browser
all the classes necessary to invoke and to use remote objects
will be downloaded to the client as necessary
Once the client applet is run, it can contact the remote
server, request a remote object instance reference, and
begin to invoke methods on it as if it were a local object
instance.
All marshalling of protocols is handled by the stub and
skeleton classes and the RMI infrastructure
@
[|
@
Ñ= Ñ
=
Microsoft's solution to the distributed-
distributed-object problem
an extension to the popular Component Object Model (COM)
Isolates the object developer from the details of distributing an object
Gives the object developer independence from the distributed-
distributed-object
infrastructure
COM object implementations are assigned special class identifiers (CLSID)
Clients who want instances of a particular COM object, request them with the
CLSID from the operating system
When the client machine has the DCOM-
DCOM-supporting facilities installed, it is
possible for these objects to be located on a remote server
When a client creates an object instance, the following happens:
The client calls CoCreateInstance() on a CLSID supported by a local server
The DCOM runtime, working with the SCM (service control manager), determines
whether the requested local server is running and can be connected to
The client is provided with a reference to an interface proxy to the object.
If an existing instance of the object is available, it will be used; otherwise, a new
instance is created
@
&'Ñ=
@
Ñ=
Uses a scheme similar to RMI and CORBA
creating proxy and stub objects to act as interfaces
between the client program, or server object
implementation, and the COM infrastructure
The existence of these objects, invisible to the
implementer, is provided by DCOM
@
Ñ=
Web pages contain ActiveX controls
downloaded to the client and executed
Along with these controls, proxy objects can be
downloaded and registered to point to
implementation objects on the appropriate
application server
@
O
'
$
@
"%
An XML-
XML-formatted document is a text document that defines a hierarchical
collection of elements.
An element is one part of a document and usually contains a textual value
An element can have child elements and thus form a hierarchy
Every XML document begins with one root element
Elements can be enhanced with attributes, which are just key/value pairs
Elements have bodies that can contain free-
free-form text, with some restrictions
XML offers the basic rules for formatting generic documents
simple parsers can read and validate their contents
with the availability of free parsers, development teams are more likely to adopt
XML document structures as a standard
Most content of an XML document is textual
elements of the document can point to, but not directly contain, nontextual
resources, such as images or applications
By describing documents with XML, generic XML parsers can be used to
extract the document's structure
@
"%
(
"%
<address>
<street>123 Pine Rd.</street>
<city>Lexington</city>
<state>SC</state>
<zip>19072</zip>
</address>
@
A collection of functions packaged and published on a
network for use by other client programs.
From the highest levels of abstraction, a Web service is
simply another type of remote procedure call (RPC).
The difference is Web services make RPC practical by
providing a set of standards for discovering and invoking the
services
The standards:
SOAP
UDDI
WSDL
@
Simple Object Access Protocol
Built on top of XML
a SOAP message is simply an XML-
XML-formatted document that validates
against a certain DTD or schema.
When used with HTTP, SOAP messages³
messages³documents
documents³ ³can be
sent to Web servers, which invoke the specified function defined
by the Web service.
The full specification for SOAP 1.1 can be found at
http://www.w3.org/TR/SOAP..
http://www.w3.org/TR/SOAP
A SOAP message consists of:
a mandatory SOAP envelope; is the top element of the XML document
an optional SOAP header; is a way messages can be extended in the
future with prior knowledge
a mandatory SOAP body
@
OÑÑ|
Universal Description, Discovery, and Integration
A mechanism for publishing and describing Web
services to potential clients
Is a set of replicated registries of information about
Web services on the network.
Registration of a service involves four core data structure
types: business information, service information, binding
information, and specification information
@
Ñ%
Web Services Description Language
A more detailed specification of the SOAP interface
A WSDL specification describes in detail how to invoke a Web
service and what to expect when it responds
A WSDL description defines a Web service as a collection of
network end points, or ports
Each port defines a collection of operations that can be invoked.
Each operation includes a set of input and output messages: the
parameters.
A binding maps a port type to a specific protocol, HTTP, and data
format, SOAP.
A port instantiates a port type and binding at a specific network address.
@
@
Ñ
'
@