Professional Documents
Culture Documents
Web Applications (1st Part)
Web Applications (1st Part)
First part
Dr. José Luis Zechinelli Martini
joseluis.zechinelli@udlap.mx
LIS – 4052
Thanks to Dr. Genoveva Vargas Solar, CNRS-LIG, Francia & Dr. Javier Espinosa, Postdoctoral fellow Centro de
Supercómputo, Barcelona, for sharing material about this topic.
A Web App is a Distributed System
n Collection of heterogeneous networked computers which communicate
and coordinate their actions by passing messages
¨ Distribution is transparent to the user so that the system appears as a single
integrated facility
¨ Processes are not executed on a single processor but rather span a number of
processors
B2B interaction
request
response
What is so particular
about Web applications?
http://www.ironpaper.com/webintel/articles/web-design-statistics-2015/#.VcJKIXhZHJI
Requirements
Developing Web Applications
Developing Web Applications
Plan
ü Context and motivation
¨ Can be human-readable
n Examples:
http://www.facebook.com:80/joseluis.zechinelli?sk=info
URI Types
n Uniform Resource Locator ( URL )
¨ Identifies and provides means for locating a resource
n Uniform Resource Name ( URN )
¨ Persistent even if the resource ceases to exit or is
unavailable
URI Schema
n Defines a set of rules for identifying a resource
n Examples
HTTP Spotify
http://vargas-solar.com spotify:user:jlzechinelli
MAIL Skype
mailto:joseluis.zechinelli@udlap.mx skype:joseluis.zechinelli
GEO LastFM
geo:48.890172,2.249922 lastfm://user/jlzechinelli
Fill Her Up - Sting Fill Her Up - Sting
Interacting with operations
Web services use case
Service
n Component exporting operations accessible via a network
op1
op2 Service
Exported URL
Applications Operations op3
Network
Service Example
n " Retrieve the current song listened by a Deezer user "
http://api.deezer.com
Operation Call Example
getCurrentSong( "bob" )
op2 Service
URL
http://api.deezer.com
Operation Call Example
<Song>
<album name=“...” />
<title name=“...” /> op2 Service
… URL
<Song>
http://api.deezer.com
Web Service
n Provides a standard means of
interoperating between
applications running on different Web Service Web Service
platforms
WSDL WSDL
n Exposes an API described in a
SOAP
machine-processable format ( WSDL )
HTTP
n Other systems interact with it using TCP / IP
SOAP messages that are conveyed
using HTTP and other web-based
technologies
Web Service Protocol Stack
n Set of standards addressing interoperability aspects
Basic
Standards
Interacting with resources
Restful services use case
+
REST in a Nutshell
n REST is all about:
à Resources
à How to manipulate the
resource
à How to represent the
resource in different ways
Designing a Resource Representation
n Understandability - Both Server and Client should be able to understand and
utilize the representation format of the resource.
30
Representation of Resources
n A resource referenced by one URI can have different representations:
¨ HTML (for browsers), XML (for application), JSON (for JavaScript)
n If the client "knows" both the HTTP application protocol and a set of data formats then it
can interact with any RESTful service in the world
Resource Oriented VS Operation Oriented
Interacting with Resources (i)
n All resources supports the same API (i.e. HTTP operations)
¨ Each operation has a specific purpose and meaning
request
Client Server
response
Execution
Client-Server Characteristics
n State Management
¨ Server-side: persistent or not
¨ Client-side: stateful or stateless
n Communication Model
¨ Connected or disconnected mode (datagrams)
¨ Synchronous or asynchronous
n Server-side Execution Model
¨ One or more processes
¨ Pool of processes or processes on-demand
Server without Persistent Data
n The execution only uses the input parameters:
¨ Does not modify the state of the server
n Ideal situation for:
¨ Fault tolerance
¨ Controlling concurrency
n Example:
¨ A service for computing mathematical functions
Server with Persistent Data
n Successive executions manipulates persistent data:
¨ Modifies the execution context
¨ Introduces problems for controlling concurrent access to resources
¨ Fault tolerance is not guaranteed
n Examples:
¨ Database Server
¨ Distributed File System
Stateless Service (i)
n The server does not keep track of client requests
n Disadvantage:
¨ Adds complexity to client architecture
n Advantages:
¨ More modular
¨ More distribution modes (multicast, replication, message coalescing, etc.)
¨ More natural way to implement complex interactions between heterogeneous systems
Asynchronous Interaction (ii)
Client-Server Characteristics
ü State Management
ü Server-side: persistent or not
ü Client-side: stateful or stateless
ü Communication Model
ü Connected or disconnected mode (datagrams)
ü Synchronous or asynchronous
n Server-side Execution Model
¨ One or more processes
¨ Pool of processes or processes on-demand
Execution models
n Iterative execution:
¨ Based on a single process
n Concurrent execution:
¨ Based on multiple processes or threads
n Processes are created on-demand
Client
Server
Processes Created On-Demand
Proxy Server
while (true) { // código a ejecutar
receive(client_id, message); result = do_service[service_id](params);
request Proxy
Client create
execute
response
Server
Pool of Processes
Proxy Servicio
while (true) { // código a ejecutar
result = do_service[service_id](params);
receive(client_id, message);
send(client_id, result);
extract(message, service_id, params);
request
Proxy
dispatcher
Client
execution
response
Server Servidor’
Servidor’
Server’