Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Application Architecture and Communication. Displaying a Web page in a Browser <a href= y.php?pollid=2.

Similar presentations


Presentation on theme: "Web Application Architecture and Communication. Displaying a Web page in a Browser <a href= y.php?pollid=2."— Presentation transcript:

1 Web Application Architecture and Communication

2 Displaying a Web page in a Browser <a href= http://www.cems.uwe.ac.uk/~cjwallac/apps/poll2/tall y.php?pollid=2 http://www.cems.uwe.ac.uk/~cjwallac/apps/poll2/tall y.php?pollid=2 > Poll results

3 Dynamic Web page needed when: consistent look and feel on each page of a large site is required data is derived from a database content depends on real time content depend on user choice business transactions e.g. e-commerce…

4 3-tier architecture A Presentation layer using Browser technologyPresentation An Application layer using a web application server platform + application programsApplication A Persistence layer using a relational database or other data store technologyPersistence

5 (Level 1 Diagram) users a information need presentation layer 1 application layer 2 HTTP requests persistence layer 3 SQL requeststables HTML files information Browser such as IE6, FoxFire Apache or MS IIS server + PHP MySQL RDBMS

6 Presentation layer arch arch Decoding URLs : protocol/host/file –Host name converted to IP address(164.11.8.19) –www.dnsstuff.comwww.dnsstuff.com Issue request to remote server using appropriate protocol (usually HTTP) accept the returned HTML (or JPEG,..) file Issue requests for any embedded links ( render (i.e. create a 2-d image ) the HTML allow plug-ins to handle new file types execute client-side scripts in JavaScript support interaction between client-side scripts and the web page (DHTML) accept user input via a variety of controls on a form

7 Persistence layer arch arch interaction with the database using standard languages e.g. SQL queries using database-specific protocol over TCP/IP define and modify the data structures (e.g. tables) themselves ( the Database Schema) insert, update and delete data maintain data persistently, with backup and recovery handle transactions to support concurrent access to the database via locking et optimise access by compilation of queries, indexing, replication of tables etc.

8 Application Layer arch arch Server (Apache, IIS) –Identifying appropriate action to take – fetch a file, pass request to an interpreter –Sending output back to caller in MIME package –Support for: thousands of concurrent users multi-threading [ allow multiple processes to run concurrently] caching [holding results in a temporary store to reduce re-calculation] Server Script (e.g. in PHP) –Interacting with the server (accessing input and generating output) –interpreting the requests according to business rules and past transactions from this client –requesting the appropriate data from the Persistence layer –computing derived data –creating the HTML (or GIF, MIDI..) for the page

9 Making sense We will be using a Patterns approach to structure our learning and analysis of systems and technology 3-tier architecture is a ‘Layered architecture’ – we will study this in detail next week. It depends on communication between programs in the layers, so we will look first at communications between processes.

10 Communication The ‘glue’ in this architecture is communication between software in the layers A single request from a user results in a complex flurry of communications and executions The flurry is composed of hundreds of simple interactionssimple interactions Sequence diagrams can be useful to provide a simplified description

11 Simple Interaction Call/reply pattern caller callee parameters function reply

12 Call – reply pattern Purpose –A local or remote process must be invoked, sending parameter values to the process and receiving a response back. Multiple solutions –How parameter values are supplied –How the result is packaged for reply

13 A function call in PHP in a php script –the script is the caller –the date procedure is the callee –the string “H:I” is the parameter Parameters identified by POSITION –the function is to get the current date and time – –the reply – a string containing the time in the required format e.g. “13:45”

14 A browser requests a page The user clicks on a link on a page. The link has an href=http://host/dir/page.html –The browser is the caller –The web server program(Apache or IIS) on the machine host is the callee. –The string “dir/page.html” is the parameter –The function is to read that file in its file store –The reply is the contents of the file as a MIME package containing an HTML fileMIME Content-type: text/html

15 A browser requests a script to execute The user clicks on a link on a page. href=http://host/dir/getemp.php?empno=5 –The browser is the caller –The web server on the machine host is the callee. –The string “dir/getemp.php?empno=5” is the parameter –The function when the suffix is php is to find the script, call it with the parameter and get the output.call it –The reply is the reply from getemp.php packaged as HTML in MIME

16 Server runs a PHP script The web server is the caller The getemp.php script is the callee The parameter is empid=5 Parameters are name/value couplets The function is to find the details of employee 5 and format a report to perform this function, the script calls mysql_connect procedures which in turn calls the mySQL server …. The reply is HTML text

17 Simple Interaction Variations How are parameters distinguished –By position –By name How is the reply packaged? How is the interface defined? –what parameters are required –what the effect of those parameters are –what replies to expect in what circumstances Does the process always produce the same output for the same input or does is depend in past calls? How does the caller find the callee? What does the caller do when is waiting for a reply? What happens if the callee doesn’t reply? How long should the caller wait until it thinks the callee isn’t going to reply? Is a reply always required?

18 Sequence diagram of SMS bus times request

19 A Pattern A pattern recurs in different guises –have the same overall structure and purpose, –with slight differences Patterns help us understand and describe complex systems Patterns ‘normalise’ descriptions – one thing in one place Same unit plays different ‘roles’ –webserver is callee with respect to (wrt) browser, caller wrt getemp.php Patterns are ‘fractal’

20

21

22 Simple PHP Calculator The workshop will get you to install and extend a simple interactive calculator. The coursework will require you to develop a simple PHP Calculator with a backend database e.g. –www.eirpharm.com has an alcohol units calculatorwww.eirpharm.com


Download ppt "Web Application Architecture and Communication. Displaying a Web page in a Browser <a href= y.php?pollid=2."

Similar presentations


Ads by Google