KEMBAR78
21 Www Web Services | PPT
CS 194: Distributed Systems   WWW and Web Services Scott Shenker and Ion Stoica  Computer Science Division Department of Electrical Engineering and Computer Sciences University of California, Berkeley Berkeley, CA 94720-1776
The Web – History (I) 1945: Vannevar Bush, Memex:  "a device in which an individual stores all his books, records, and communications, and which is mechanized so that it may be consulted with exceeding speed and flexibility"  Vannevar Bush (1890-1974)  Memex (See http://www.iath.virginia.edu/elab/hfl0051.html)
The Web – History (II) 1967, Ted Nelson, Xanadu: A world-wide publishing network that would allow information to be stored not as separate files but as connected literature Owners of documents would be automatically paid via electronic means for the virtual copying of their documents  Coined the term “Hypertext” Ted Nelson
The Web – History (III) World Wide Web (WWW): a distributed database of “pages” linked through  Hypertext Transport Protocol  (HTTP) First HTTP implementation - 1990  Tim Berners-Lee at CERN HTTP/0.9 – 1991 Simple GET command for the Web HTTP/1.0 –1992 Client/Server information, simple caching HTTP/1.1 - 1996  Tim Berners-Lee
The Web Core components: Servers: store files and execute remote commands Browsers: retrieve and display “pages”  Uniform Resource Locators (URLs): way to refer to pages A protocol to transfer information between clients and servers HTTP
Uniform Record Locator (URL) protocol://host-name:port/directory-path/resource Extend the idea of hierarchical namespaces to include anything in a file system ftp://www.cs.berkeley.edu/~istoica/cs194/05/lecture.ppt Extend to program executions as well… http://us.f413.mail.yahoo.com/ym/ShowLetter?box=%40B%40Bulk&MsgId=2604_1744106_29699_1123_1261_0_28917_3552_1289957100&Search=&Nhead=f&YY=31454&order=down&sort=date&pos=0&view=a&head=b Server side processing can be incorporated in the name
Web and DNS URLs use hostnames Thus, content names are tied to specific hosts This is bad! Uniform Resource Names (URNs) are one proposal to achieve persistence Not discussed in this lecture
Hyper Text Transfer Protocol (HTTP) Client-server architecture Synchronous request/reply protocol  Runs over TCP, Port 80 Stateless
Big Picture Client Server TCP Syn TCP syn + ack  TCP ack + HTTP GET Establish connection Request response Client  request Close connection . . .
Hyper Text Transfer Protocol Commands GET – transfer resource from given URL HEAD – GET resource metadata (headers) only PUT – store/modify resource under given URL DELETE – remove resource POST – provide input for a process identified by the given URL (usually used to post CGI parameters)
Response Codes 1x informational 2x success 3x redirection 4x client error in request 5x server error; can’t satisfy the request
Client Request Steps to get the resource:  http://www.eecs.berkeley.edu/index.html   Use DNS to obtain the IP address of  www.eecs.berkeley.edu Send to an HTTP request: GET /index.html HTTP/1.0
Server Response HTTP/1.0 200 OK Content-Type: text/html Content-Length: 1234 Last-Modified: Mon, 19 Nov 2001 15:31:20 GMT <HTML> <HEAD> <TITLE>EECS Home Page</TITLE> </HEAD> … </BODY> </HTML>
HTTP/1.0 Example Client Server Request image 1 Transfer image 1 Request image 2 Transfer image 2 Request text Transfer text Finish display page
HHTP/1.0 Performance Create a new TCP connection for each resource Large number of embedded objects in a web page Many short lived connections TCP transfer Too slow for small object May never exit slow-start phase Connections may be set up in parallel (5 is default in most browsers)
HTTP/1.0 Caching Support Exploit locality of reference A modifier to the GET request: If-modified-since  – return a “not modified” response if resource was not modified since specified time  A response header: Expires  – specify to the client for how long it is safe to cache the resource A request directive:  No-cache  – ignore all caches and get resource directly from server These features can be best taken advantage of with HTTP proxies Locality of reference increases if many clients share a proxy
HTTP/1.1 (1996) Performance:  Persistent connections  Pipelined requests/responses … Efficient caching support Network Cache assumed more explicitly in the design Gives more control to the server on how it wants data cached Support for virtual hosting Allows to run multiple web servers on the same machine
Persistent Connections Allow multiple transfers over one connection Avoid multiple TCP connection setups Avoid multiple TCP slow starts
Pipelined Requests/Responses Buffer requests and responses to reduce the number of packets Multiple requests can be contained in one TCP segment Note: order of responses has to be maintained Client Server Request 1 Request 2 Request 3 Transfer 1 Transfer 2 Transfer 3
Caching and Replication Problem: You are a web content provider  How do you handle millions of web clients? How do you ensure that all clients experience good performance? How do you maintain availability in the presence of server and network failures? Solutions: Add more servers at different locations    If you are CNN this might work! Caching Content Distribution Networks (Replication)
“Base-line” Many clients transfer same information  Generate unnecessary server and network load Clients experience unnecessary latency Server Clients Backbone ISP ISP-1 ISP-2
Reverse Caches Cache documents close to server    decrease server load Typically done by content providers Clients Backbone ISP ISP-1 ISP-2 Server Reverse caches
Forward Proxies Cache  documents close to clients    reduce network traffic and decrease latency Typically done by ISPs or corporate LANs Clients Backbone ISP ISP-1 ISP-2 Server Reverse caches Forward caches
Content Distribution Networks (CDNs) Integrate forward and reverse caching functionalities into one overlay network (usually) administrated by one entity Example: Akamai Documents are cached both  As a result of clients’ requests ( pull ) Pushed  in the expectation of a high access rate Beside caching do processing, e.g., Handle dynamic web pages Transcoding
CDNs (cont’d) Clients ISP-1 Server Forward caches Backbone ISP ISP-2 CDN
Example: Akamai Akamai creates new domain names for each client content provider. e.g.,  a128.g.akamai.net The CDN’s DNS servers are authoritative for the new domains The client content provider modifies its content so that embedded URLs reference the new domains. “ Akamaize” content, e.g.:  http://www.cnn.com/image-of-the-day.gif  becomes  http://a128.g.akamai.net/image-of-the-day.gif .
Example: Akamai get http://www.nhc.noaa.gov a DNS server for nhc.noaa.gov b c local DNS server www.nhc.noaa.gov “ Akamaizes” its content. “ Akamaized” response object has inline URLs for secondary content at  a128.g.akamai.net  and other Akamai-managed DNS names . akamai.net DNS servers Akamai servers store/cache secondary content for “Akamaized” services. lookup  a128.g.akamai.net
Core Web Technologies HTML CGI XML
What is HTML? HTML is the  lingua franca  for web publishing.  Hyper Text Markup Language is based on SGML (Standard Generalized Markup Language) HTML 4.0:  http://www.w3.org/TR/html4/intro/intro.html Initial version invented by Tim Berners-Lee  Originally developed for sharing scientific documents on the web
What is HTML? HTML documents are plain text files Contain text and HTML  mark-up tags Markup tags  describe elements representing the style and structure of the visual document
Markup Tags An HTML element may include a name, some attributes and some text or hypertext, and will appear in an HTML document as  <tagName>   text   </tagName>   <tagName   attribute=argument>   text   </tagName> , or just  <tagName>   Examples:  <title>   My Document   </title> <a href= http:// www.cs.berkeley.edu / >Berkeley CS Web page<a>
A trivial HTML document <HTML> <HEAD> <TITLE>  My web page   </TITLE> </HEAD> <BODY> Welcome to my webpage! This is on the same line. </BODY> </HTML> HTML HEAD BODY Welcome to my webpage! This is on the same line. TITLE My web page Nesting structure
Common Gateway Interface (CGI) CGI – general standard specifying how programs can be run on server, from the WWW Any program in any language can be a CGI program - it just has to follow the CGI rules These rules define how programs get data  (e.g., HTML form data) and how to make sure web server knows it’s a CGI program Call of a CGI program (like any HTML page): <a href=“http://www.mysite/cgi-bin/myprog”> Run my CGI program </a>
Client-Server CGI Architecture
CGI Examples Any programming language can be used for CGI (e.g., shell script) Every CGI program must write out data to send back to web browser. The first thing they must write out is MIME type of file (e.g., text/plain, text/html) #!/bin/sh echo “Content-type: text/plain” echo echo “Hello World”
CGI and Forms CGI programs can process data from forms: If method=“get” then the form data gets put in variable QUERY_STRING available to CGI programs <form method=&quot;get&quot;  action= &quot;http://www.foo.org/cgi-bin/cgiwrap/example.cgi&quot;> <p> Name: <input type=&quot;text&quot; name=&quot;username&quot; /> </p> <p> Age: <input type=&quot;text&quot; name=&quot;age&quot; /> </p> <p> <input type=&quot;submit&quot; value=&quot;Do it&quot; /> </p> </form>
GET vs POST Using “get” method: Data added to URL as ..prog?var=val etc. This data is put in QUERY_STRING variable available to CGI programs E.g.:  http://us.f413.mail.yahoo.com/ym/ShowLetter?box=%40B%40Bulk&MsgId=2604_1744106_29699_1123_1261_0_28917_3552_1289957100&Search=& Nhead = f&YY =31454&order= down&sort = date&pos =0&view= a&head =b Alternative is to use “post” method: Data is sent separately to URL. CGI program reads this data from its standard input.
CGI Security CGI programs let anyone in the world run a program on your system Special  wrapper  programs may be used to do some security checks
XML: eXtensible Markup Language A simple, very flexible text format derived from SGML  Rapidly emerging as the language of choice for data sharing on the Internet
XML Example An XML definition for referring to a journal article. (1) <!ELEMENT article (title, author+,journal)> (2)  <!ELEMENT title (#PCDATA)> (3)  <!ELEMENT author (name, affiliation?)> (4)  <!ELEMENT name (#PCDATA)> (5)  <!ELEMENT affiliation (#PCDATA)> (6)  <!ELEMENT journal (jname, volume, number?, month? pages, year)> (7)  <!ELEMENT jname (#PCDATA)> (8)  <!ELEMENT volume (#PCDATA)> (9)  <!ELEMENT number (#PCDATA)> (10)  <!ELEMENT month (#PCDATA)> (11)  <!ELEMENT pages (#PCDATA)> (12)  <!ELEMENT year (#PCDATA)>
XML Example (cont’d) XML document using XML definitions from previous slide (1) <?xml = version &quot;1.0&quot;> (2) <!DOCTYPE article SYSTEM &quot;article.dtd&quot;> (3) <article> (4)   <title> Prudent Engineering Practice for Cryptographic Protocols</title> (5)   <author><name>M. Abadi</name></author> (6)   <author><name>R. Needham</name></author> (7)   <journal> (8) <jname>IEEE Transactions on Software Engineering</jname> (9) <volume>22</volume> (10) <number>12</number> (11) <month>January</month> (12) <pages>6 – 15</pages> (13) <year>1996</year> (14)   </journal> (15) </article>
XML vs HTML? HTML  combines  structure and display, while XML  separates  them HTML – presentation markup language: it describes the look, feel, and actions of web pages XML describes document structure: what words in documents are Flexibility: HTML – only one standard definition of all of the tags XML – custom documents defining the meaning of tags XML may replace HTML in the future
Web Services WS are applications that communicate using internet-based middleware WS are network-based software applications developed to interact with other applications using Internet standard technologies and connections to seamlessly perform business process
Web Services Architecture Stacks www.w3c.org
WS Components A standard way for communication (SOAP) A uniform data representation and exchange mechanism (XML) A standard meta language to describe the services offered (WSDL) A mechanism to register and locate WS based applications (UDDI)
What is SOAP? Lightweight protocol used for exchange of messages in a decentralized, distributed environment Platform-independent Used for Remote Procedure Calls W3C note defines the use of SOAP with XML as payload and HTTP as transport
SOAP Elements Envelope (mandatory) Top element of the XML document representing the message Header (optional) Determines how a recipient of a SOAP message should process the message Adds features to the SOAP message such as authentication, transaction management, payment, message routes, etc… Body (mandatory) Exchanges information intended for the recipient of the message Typical use is for RPC calls and error reporting
SOAP Elements SOAP Encoding Envelope package Header/Body pattern Similar to how HTTP works Header Body
Simple Example <Envelope> <Header> <transId>345</transId> </Header> <Body> <Add> <n1>3</n1> <n2>4</n2> </Add> </Body> </Envelope> c = Add(n1, n2)
SOAP Request <SOAP-ENV:Envelope  xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Header> <t:transId xmlns:t=“http://a.com/trans”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“http://a.com/Calculator”> <n1>3</n1> <n2>4</n2> </m:Add> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
SOAP Request <SOAP-ENV:Envelope  xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Header> <t:transId xmlns:t=“http://a.com/trans”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“http://a.com/Calculator”> <n1>3</n1> <n2>4</n2> </m:Add> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Scopes the message to the SOAP namespace describing the SOAP envelope Establishes the type of encoding that is used within the message (different data types supported)
SOAP Request <SOAP-ENV:Envelope  xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Header> <t:transId xmlns:t=“http://a.com/trans”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“http://a.com/Calculator”> <n1>3</n1> <n2>4</n2> </m:Add> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Defines the method Qualifies transaction Id
SOAP Response <SOAP-ENV:Envelope  xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Header> <t:transId xmlns:t=“http://a.com/trans”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m: AddResponse  xmlns:m=“http://a.com/Calculator”> <result>7</result> </m: AddResponse > </SOAP-ENV:Body> </SOAP-ENV:Envelope> Response typically uses method name with “Response” appended
XML-RPC vs SOAP XML-RPC: lower common denominator form of communication Simple, easy to understand (only 7 pages specification) SOAP: can transfer more sophisticated information (could define virtually any data structure) Flexible, but complex Supported by industry
WSDL Web Services Description Language is an XML document Describes WS functionality How WS communicate & where it is accessible (What, Where & How)
UDDI Universal Description Definition Interface A standard discovery mechanism for WS Users can query a UDDI registry (company name, service type, Industry category or other criteria) Provides pointers to WSDL document UDDI is also based on XML

21 Www Web Services

  • 1.
    CS 194: DistributedSystems WWW and Web Services Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering and Computer Sciences University of California, Berkeley Berkeley, CA 94720-1776
  • 2.
    The Web –History (I) 1945: Vannevar Bush, Memex: &quot;a device in which an individual stores all his books, records, and communications, and which is mechanized so that it may be consulted with exceeding speed and flexibility&quot; Vannevar Bush (1890-1974) Memex (See http://www.iath.virginia.edu/elab/hfl0051.html)
  • 3.
    The Web –History (II) 1967, Ted Nelson, Xanadu: A world-wide publishing network that would allow information to be stored not as separate files but as connected literature Owners of documents would be automatically paid via electronic means for the virtual copying of their documents Coined the term “Hypertext” Ted Nelson
  • 4.
    The Web –History (III) World Wide Web (WWW): a distributed database of “pages” linked through Hypertext Transport Protocol (HTTP) First HTTP implementation - 1990 Tim Berners-Lee at CERN HTTP/0.9 – 1991 Simple GET command for the Web HTTP/1.0 –1992 Client/Server information, simple caching HTTP/1.1 - 1996 Tim Berners-Lee
  • 5.
    The Web Corecomponents: Servers: store files and execute remote commands Browsers: retrieve and display “pages” Uniform Resource Locators (URLs): way to refer to pages A protocol to transfer information between clients and servers HTTP
  • 6.
    Uniform Record Locator(URL) protocol://host-name:port/directory-path/resource Extend the idea of hierarchical namespaces to include anything in a file system ftp://www.cs.berkeley.edu/~istoica/cs194/05/lecture.ppt Extend to program executions as well… http://us.f413.mail.yahoo.com/ym/ShowLetter?box=%40B%40Bulk&MsgId=2604_1744106_29699_1123_1261_0_28917_3552_1289957100&Search=&Nhead=f&YY=31454&order=down&sort=date&pos=0&view=a&head=b Server side processing can be incorporated in the name
  • 7.
    Web and DNSURLs use hostnames Thus, content names are tied to specific hosts This is bad! Uniform Resource Names (URNs) are one proposal to achieve persistence Not discussed in this lecture
  • 8.
    Hyper Text TransferProtocol (HTTP) Client-server architecture Synchronous request/reply protocol Runs over TCP, Port 80 Stateless
  • 9.
    Big Picture ClientServer TCP Syn TCP syn + ack TCP ack + HTTP GET Establish connection Request response Client request Close connection . . .
  • 10.
    Hyper Text TransferProtocol Commands GET – transfer resource from given URL HEAD – GET resource metadata (headers) only PUT – store/modify resource under given URL DELETE – remove resource POST – provide input for a process identified by the given URL (usually used to post CGI parameters)
  • 11.
    Response Codes 1xinformational 2x success 3x redirection 4x client error in request 5x server error; can’t satisfy the request
  • 12.
    Client Request Stepsto get the resource: http://www.eecs.berkeley.edu/index.html Use DNS to obtain the IP address of www.eecs.berkeley.edu Send to an HTTP request: GET /index.html HTTP/1.0
  • 13.
    Server Response HTTP/1.0200 OK Content-Type: text/html Content-Length: 1234 Last-Modified: Mon, 19 Nov 2001 15:31:20 GMT <HTML> <HEAD> <TITLE>EECS Home Page</TITLE> </HEAD> … </BODY> </HTML>
  • 14.
    HTTP/1.0 Example ClientServer Request image 1 Transfer image 1 Request image 2 Transfer image 2 Request text Transfer text Finish display page
  • 15.
    HHTP/1.0 Performance Createa new TCP connection for each resource Large number of embedded objects in a web page Many short lived connections TCP transfer Too slow for small object May never exit slow-start phase Connections may be set up in parallel (5 is default in most browsers)
  • 16.
    HTTP/1.0 Caching SupportExploit locality of reference A modifier to the GET request: If-modified-since – return a “not modified” response if resource was not modified since specified time A response header: Expires – specify to the client for how long it is safe to cache the resource A request directive: No-cache – ignore all caches and get resource directly from server These features can be best taken advantage of with HTTP proxies Locality of reference increases if many clients share a proxy
  • 17.
    HTTP/1.1 (1996) Performance: Persistent connections Pipelined requests/responses … Efficient caching support Network Cache assumed more explicitly in the design Gives more control to the server on how it wants data cached Support for virtual hosting Allows to run multiple web servers on the same machine
  • 18.
    Persistent Connections Allowmultiple transfers over one connection Avoid multiple TCP connection setups Avoid multiple TCP slow starts
  • 19.
    Pipelined Requests/Responses Bufferrequests and responses to reduce the number of packets Multiple requests can be contained in one TCP segment Note: order of responses has to be maintained Client Server Request 1 Request 2 Request 3 Transfer 1 Transfer 2 Transfer 3
  • 20.
    Caching and ReplicationProblem: You are a web content provider How do you handle millions of web clients? How do you ensure that all clients experience good performance? How do you maintain availability in the presence of server and network failures? Solutions: Add more servers at different locations  If you are CNN this might work! Caching Content Distribution Networks (Replication)
  • 21.
    “Base-line” Many clientstransfer same information Generate unnecessary server and network load Clients experience unnecessary latency Server Clients Backbone ISP ISP-1 ISP-2
  • 22.
    Reverse Caches Cachedocuments close to server  decrease server load Typically done by content providers Clients Backbone ISP ISP-1 ISP-2 Server Reverse caches
  • 23.
    Forward Proxies Cache documents close to clients  reduce network traffic and decrease latency Typically done by ISPs or corporate LANs Clients Backbone ISP ISP-1 ISP-2 Server Reverse caches Forward caches
  • 24.
    Content Distribution Networks(CDNs) Integrate forward and reverse caching functionalities into one overlay network (usually) administrated by one entity Example: Akamai Documents are cached both As a result of clients’ requests ( pull ) Pushed in the expectation of a high access rate Beside caching do processing, e.g., Handle dynamic web pages Transcoding
  • 25.
    CDNs (cont’d) ClientsISP-1 Server Forward caches Backbone ISP ISP-2 CDN
  • 26.
    Example: Akamai Akamaicreates new domain names for each client content provider. e.g., a128.g.akamai.net The CDN’s DNS servers are authoritative for the new domains The client content provider modifies its content so that embedded URLs reference the new domains. “ Akamaize” content, e.g.: http://www.cnn.com/image-of-the-day.gif becomes http://a128.g.akamai.net/image-of-the-day.gif .
  • 27.
    Example: Akamai gethttp://www.nhc.noaa.gov a DNS server for nhc.noaa.gov b c local DNS server www.nhc.noaa.gov “ Akamaizes” its content. “ Akamaized” response object has inline URLs for secondary content at a128.g.akamai.net and other Akamai-managed DNS names . akamai.net DNS servers Akamai servers store/cache secondary content for “Akamaized” services. lookup a128.g.akamai.net
  • 28.
  • 29.
    What is HTML?HTML is the lingua franca for web publishing. Hyper Text Markup Language is based on SGML (Standard Generalized Markup Language) HTML 4.0: http://www.w3.org/TR/html4/intro/intro.html Initial version invented by Tim Berners-Lee Originally developed for sharing scientific documents on the web
  • 30.
    What is HTML?HTML documents are plain text files Contain text and HTML mark-up tags Markup tags describe elements representing the style and structure of the visual document
  • 31.
    Markup Tags AnHTML element may include a name, some attributes and some text or hypertext, and will appear in an HTML document as <tagName> text </tagName> <tagName attribute=argument> text </tagName> , or just <tagName> Examples: <title> My Document </title> <a href= http:// www.cs.berkeley.edu / >Berkeley CS Web page<a>
  • 32.
    A trivial HTMLdocument <HTML> <HEAD> <TITLE> My web page </TITLE> </HEAD> <BODY> Welcome to my webpage! This is on the same line. </BODY> </HTML> HTML HEAD BODY Welcome to my webpage! This is on the same line. TITLE My web page Nesting structure
  • 33.
    Common Gateway Interface(CGI) CGI – general standard specifying how programs can be run on server, from the WWW Any program in any language can be a CGI program - it just has to follow the CGI rules These rules define how programs get data (e.g., HTML form data) and how to make sure web server knows it’s a CGI program Call of a CGI program (like any HTML page): <a href=“http://www.mysite/cgi-bin/myprog”> Run my CGI program </a>
  • 34.
  • 35.
    CGI Examples Anyprogramming language can be used for CGI (e.g., shell script) Every CGI program must write out data to send back to web browser. The first thing they must write out is MIME type of file (e.g., text/plain, text/html) #!/bin/sh echo “Content-type: text/plain” echo echo “Hello World”
  • 36.
    CGI and FormsCGI programs can process data from forms: If method=“get” then the form data gets put in variable QUERY_STRING available to CGI programs <form method=&quot;get&quot; action= &quot;http://www.foo.org/cgi-bin/cgiwrap/example.cgi&quot;> <p> Name: <input type=&quot;text&quot; name=&quot;username&quot; /> </p> <p> Age: <input type=&quot;text&quot; name=&quot;age&quot; /> </p> <p> <input type=&quot;submit&quot; value=&quot;Do it&quot; /> </p> </form>
  • 37.
    GET vs POSTUsing “get” method: Data added to URL as ..prog?var=val etc. This data is put in QUERY_STRING variable available to CGI programs E.g.: http://us.f413.mail.yahoo.com/ym/ShowLetter?box=%40B%40Bulk&MsgId=2604_1744106_29699_1123_1261_0_28917_3552_1289957100&Search=& Nhead = f&YY =31454&order= down&sort = date&pos =0&view= a&head =b Alternative is to use “post” method: Data is sent separately to URL. CGI program reads this data from its standard input.
  • 38.
    CGI Security CGIprograms let anyone in the world run a program on your system Special wrapper programs may be used to do some security checks
  • 39.
    XML: eXtensible MarkupLanguage A simple, very flexible text format derived from SGML Rapidly emerging as the language of choice for data sharing on the Internet
  • 40.
    XML Example AnXML definition for referring to a journal article. (1) <!ELEMENT article (title, author+,journal)> (2) <!ELEMENT title (#PCDATA)> (3) <!ELEMENT author (name, affiliation?)> (4) <!ELEMENT name (#PCDATA)> (5) <!ELEMENT affiliation (#PCDATA)> (6) <!ELEMENT journal (jname, volume, number?, month? pages, year)> (7) <!ELEMENT jname (#PCDATA)> (8) <!ELEMENT volume (#PCDATA)> (9) <!ELEMENT number (#PCDATA)> (10) <!ELEMENT month (#PCDATA)> (11) <!ELEMENT pages (#PCDATA)> (12) <!ELEMENT year (#PCDATA)>
  • 41.
    XML Example (cont’d)XML document using XML definitions from previous slide (1) <?xml = version &quot;1.0&quot;> (2) <!DOCTYPE article SYSTEM &quot;article.dtd&quot;> (3) <article> (4) <title> Prudent Engineering Practice for Cryptographic Protocols</title> (5) <author><name>M. Abadi</name></author> (6) <author><name>R. Needham</name></author> (7) <journal> (8) <jname>IEEE Transactions on Software Engineering</jname> (9) <volume>22</volume> (10) <number>12</number> (11) <month>January</month> (12) <pages>6 – 15</pages> (13) <year>1996</year> (14) </journal> (15) </article>
  • 42.
    XML vs HTML?HTML combines structure and display, while XML separates them HTML – presentation markup language: it describes the look, feel, and actions of web pages XML describes document structure: what words in documents are Flexibility: HTML – only one standard definition of all of the tags XML – custom documents defining the meaning of tags XML may replace HTML in the future
  • 43.
    Web Services WSare applications that communicate using internet-based middleware WS are network-based software applications developed to interact with other applications using Internet standard technologies and connections to seamlessly perform business process
  • 44.
    Web Services ArchitectureStacks www.w3c.org
  • 45.
    WS Components Astandard way for communication (SOAP) A uniform data representation and exchange mechanism (XML) A standard meta language to describe the services offered (WSDL) A mechanism to register and locate WS based applications (UDDI)
  • 46.
    What is SOAP?Lightweight protocol used for exchange of messages in a decentralized, distributed environment Platform-independent Used for Remote Procedure Calls W3C note defines the use of SOAP with XML as payload and HTTP as transport
  • 47.
    SOAP Elements Envelope(mandatory) Top element of the XML document representing the message Header (optional) Determines how a recipient of a SOAP message should process the message Adds features to the SOAP message such as authentication, transaction management, payment, message routes, etc… Body (mandatory) Exchanges information intended for the recipient of the message Typical use is for RPC calls and error reporting
  • 48.
    SOAP Elements SOAPEncoding Envelope package Header/Body pattern Similar to how HTTP works Header Body
  • 49.
    Simple Example <Envelope><Header> <transId>345</transId> </Header> <Body> <Add> <n1>3</n1> <n2>4</n2> </Add> </Body> </Envelope> c = Add(n1, n2)
  • 50.
    SOAP Request <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Header> <t:transId xmlns:t=“http://a.com/trans”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“http://a.com/Calculator”> <n1>3</n1> <n2>4</n2> </m:Add> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
  • 51.
    SOAP Request <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Header> <t:transId xmlns:t=“http://a.com/trans”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“http://a.com/Calculator”> <n1>3</n1> <n2>4</n2> </m:Add> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Scopes the message to the SOAP namespace describing the SOAP envelope Establishes the type of encoding that is used within the message (different data types supported)
  • 52.
    SOAP Request <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Header> <t:transId xmlns:t=“http://a.com/trans”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:Add xmlns:m=“http://a.com/Calculator”> <n1>3</n1> <n2>4</n2> </m:Add> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Defines the method Qualifies transaction Id
  • 53.
    SOAP Response <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/”> <SOAP-ENV:Header> <t:transId xmlns:t=“http://a.com/trans”>345</t:transId> </SOAP-ENV:Header> <SOAP-ENV:Body> <m: AddResponse xmlns:m=“http://a.com/Calculator”> <result>7</result> </m: AddResponse > </SOAP-ENV:Body> </SOAP-ENV:Envelope> Response typically uses method name with “Response” appended
  • 54.
    XML-RPC vs SOAPXML-RPC: lower common denominator form of communication Simple, easy to understand (only 7 pages specification) SOAP: can transfer more sophisticated information (could define virtually any data structure) Flexible, but complex Supported by industry
  • 55.
    WSDL Web ServicesDescription Language is an XML document Describes WS functionality How WS communicate & where it is accessible (What, Where & How)
  • 56.
    UDDI Universal DescriptionDefinition Interface A standard discovery mechanism for WS Users can query a UDDI registry (company name, service type, Industry category or other criteria) Provides pointers to WSDL document UDDI is also based on XML