web services. 2 internet collection of physically interconnected computers. messages decomposed into...

21
Web Services

Upload: polly-page

Post on 19-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

Web Services

Page 2: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

2

Internet

• Collection of physically interconnected computers.

• Messages decomposed into packets.

• Packets transmitted from source to destination using a store-and-forward technique.

• Routing algorithm directs packets to destination

Page 3: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

3

Connection-Oriented Protocol

• Prior to the transmission a connection is established between source and destination. Each end maintains state information:– Sequence numbers, acknowledgements provide reliability

• guarantee that packet loss or duplication will be detected• packets arrive in the order they were sent. Destination address

– Buffers, flow control algorthm guarantee transmission rate appropriate to both sender and receiver

– Destination address– Characteristics of connection (e.g., out-of-band

messages)

• Problem: Overhead of setting up and taking down connection.

• Transmission Control Protocol (TCP) is connection-oriented.

Page 4: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

4

Hypertext Transfer Protocol (HTTP)

• A high level protocol built on top of a TCP connection for exchanging messages (with arbitrary content)– Each (request) message from client to server is followed

by a (response) message from server to client.

– Facilitates the remote invocation of methods on the server.

• Web: A set of client and server processes on the Internet that communicate via HTTP.

Page 5: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

5

Protocol Stack

HTTP

TCP

Link LevelProtocol

Protocol for tranmitting packets between neighboring nodes

Network LevelProtocol End-to-end protocol

Added features to supportclient interactions (reliabilityflow control, ..)

Page 6: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

6

Clients and Servers

• Client: browser capable of displaying HTML pages.• Web Server: stores pages for distribution to clients.• Pages identified by Uniform Resource Locator (URL).

– <protocol>: protocol to be used to communicate with host.• Example - http, ftp

– <host_name>: Directory server translates this into the host’s internet address

• Example – www.cs.sunysb.edu becomes 155.233.123.532

– <file_name>: name of file on host.

<protocol>://<host_name>/<file_name>

Page 7: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

7

HTTP Request Format

Start line: <method> <URL> <protocol_version> CrLfFollowed by: <header>*Followed by: CrLfFollowed by: <data>

<method> = GET | HEAD | POST | PUT | ….<protocol_version> = HTTP/1.1 | ….

there canbe severalheader lines

Page 8: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

8

HTTP Request Format

<header> = <field_name> : <value> CrLf<field_name> =

From | -- sender’s e-mail addressAccept | -- acceptable response formatsUser-Agent | -- identifies requestor’s programReferer | -- URL of document containing link

(for generating back links)If-Modified-Since | -- send document only if modified

since <value> (used with GET)Content-Type | -- type of data (application/soap+xml

for SOAP)Host | -- destination host…

<data> = ASCII text (default)

Page 9: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

9

Request Methods

• GET – response body contains data identified by argument URL

• HEAD – response header describes data identified by argument URL (no response body)– Use: has page changed since last fetched?

• PUT – request body contains page to be stored at argument URL

Page 10: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

10

Request Methods

• DELETE – delete data at argument URL• POST – request body contains a new object

to be placed subordinate to object at argument URL– Use: adding file to directory named by URL– Use: information entered by user on displayed

form

• Others ….

Page 11: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

11

Simple Client/Server Interaction I

1. User supplies URL (clicks on link)

http://yourbusiness.com/~items/printers.html

2. Browser translates <host_name> (yourbusiness.com) to host internet address (using name server)

3. Browser assumes a port number of 80 for http (if no port is explicitly provided as part of <host_name> )

• Program at port 80 interprets http headers

Page 12: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

12

Simple Client/Server Interaction I

4. Browser sets up TCP connection to yourbusiness.com at (host address, port number)

5. Browser sends http message GET ~items/printers.html HTTP/1.0 over connection

Page 13: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

13

HTTP Response

Status line: <HTTP_version> <status_code> <reason_line> CrLf

Followed by: < header >*Followed by: <data>

Page 14: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

14

HTTP Response

<status_code> = 3 digitsEx: 2xx -- success 4xx -- bad request from client 5xx -- server failed to fulfill valid request

<reason_line> = explanation for human reader<header> = <field_name> : <value> CrLf<field_name> = Allowed | -- methods supported by URL

Date | -- creation date for response Expires | -- expiration date for data Last-Modified | -- creation date for object Content-Length | Content-Type | ….

Page 15: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

15

Simple Client/Server Interaction I

6. Server sends response message with requested html page to browser

7. Server releases TCP connection (stateless)8. Browser receives page and displays it

HTTP/1.0 200 Document followsDate: <date>Content-Type: text/htmlContent-Length: integerExpires: date

html document ~items/printers.html goes here

Page 16: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

16

Simple Client/Server Interaction II

1. Page displayed by browser is a form with tag<FORM ACTION=“http://yourbusiness.com/servlets/placeorder”

METHOD=…>

2. Client fills input boxes3. If METHOD=GET, client sets up connection to

yourbusiness.com and sends http request:

Values in input boxes encoded as suffix. Since ACTION designates a servlet, server invokes placeorder

GET /servlets/placeorder?name1=value1&name2=value2 HTTP/1.0

Page 17: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

17

Simple Client/Server Interaction II

4. If METHOD=POST, client sends http request invoking POST to yourbusiness.com; data contains values in input boxes.POST /servlets/placeorder HTTP/1.0Content-Type: text/……………….Content-Length: 54321

Printer=HP660&Name=Art+Bernstein

Page 18: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

18

HyperText Transfer Protocol (HTTP 1.1)

1. Client sets up TCP connection to server named in URL

2. Client sends a request

3. Client receives a response

4. if (server has not disconnected) goto 2

else goto 1

Page 19: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

19

Intermediaries

• Frequently browser does not communicate directly with server; communication passes through intermediate node.

• Intermediaries perform several functions.– Security - filter unwanted messages– Protocol conversion - browser and server don’t

speak same protocol– Caching of web pages

Page 20: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

20

Intermediary I – Filter Based Firewall

• Provides security

• Client establishes connection to serve,– but proxy is on the path – proxy operates at the network level (form of

router) – proxy discards packets based on source or

destination host address/port number

Page 21: Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination

21

Intermediary II – Proxy-Based Firewall

• Operates at the application level• Client establishes connection to proxy instead of server• Can analyze http header to create finer security policies

– Ex: particular web pages can only be sent to particular clients

• Can do caching of recently requested pages• Can do protocol conversion

– Ex: convert http to ftp (if server doesn’t understand http)