Web Services 2009


Published on

Published in: Education, Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Web Services 2009

  1. 1. Web Services
  2. 2. What are web Services? <ul><li>A web service is a program that calls a method which is on another computer on the network. </li></ul><ul><li>A ' Web service' (also Web Service ) is defined by the W3C as &quot;a software system designed to support interoperable Machine to Machine interaction over a network &quot; [1] . Web services are frequently just Web APIs that can be accessed over a network, such as the Internet , and executed on a remote system hosting the requested services. </li></ul><ul><li>(Wikipedia, accessed July 2008, http://en.wikipedia.org/wiki/Web_service) </li></ul>
  3. 3. Web Services are Made Up of <ul><li>Two pieces of information; </li></ul><ul><ul><li>Method Info: what method is being called. </li></ul></ul><ul><ul><li>Scoping Info: what arguments are needed. </li></ul></ul><ul><li>This information is packaged into an envelope and transported across the network. </li></ul>
  4. 4. Network Layers <ul><li>Each task is represented in a layer. </li></ul><ul><li>The current layer systems is called the Internet Protocol Stack. </li></ul><ul><li>Each layer has a set of protocols that set the rules for how each layer behaves. </li></ul><ul><li>The protocols are to break the information down into datagrams or packets so they can travel over the network to their destination. Then the same protocols are used at the destination to put the datagrams / packets back to their original format. </li></ul>
  5. 5. Internet protocol Stack <ul><li>application: supporting network applications </li></ul><ul><ul><li>FTP, SMTP, STTP </li></ul></ul><ul><li>transport: host-host data transfer </li></ul><ul><ul><li>TCP, UDP </li></ul></ul><ul><li>network: routing of datagrams from source to destination </li></ul><ul><ul><li>IP, routing protocols </li></ul></ul><ul><li>link: data transfer between neighboring network elements </li></ul><ul><ul><li>PPP, Ethernet </li></ul></ul>application transport network link
  6. 6. Encapsulation message segment datagram frame source application transport network link destination application transport network link router switch H t H n H l M H t H n M H t M M H t H n H l M H t H n M H t M M network link link H t H n H l M H t H n M H t H n H l M H t H n M H t H n H l M H t H n H l M
  7. 7. Technologies used over the web. <ul><li>HTTP: Hypertext Transfer Protocol (HTTP). </li></ul><ul><li>RPC: Remote Procedure call. </li></ul><ul><li>XML-RPC: Remote Procedure call encoded in xml. </li></ul><ul><li>SOAP: Simple Object Access Protocol. </li></ul><ul><li>WSDL: Web Service Description Language. </li></ul>
  8. 8. Client-side Scripting <ul><li>Scripting is a technology that uses a set of instructions to perform a task. </li></ul><ul><li>Client-side Scripting is a web page saved as a htm or html extension. </li></ul><ul><li>These web pages can run on any computer that has a web browser. </li></ul><ul><li>These web pages are often referred to as Static pages </li></ul>
  9. 9. Server-side Scripting <ul><li>Scripting is a technology that uses a set of instructions to perform a task. </li></ul><ul><li>Server-side scripting is a technology that creates web pages that will only operate when accessed from a web server. </li></ul><ul><li>Server-side scripting is also known as Dynamic web pages. </li></ul>
  10. 10. Dynamic Web Pages <ul><li>One of the changes that evolved was the first-generation Internet/intranet application. </li></ul><ul><li>It was an extension to Web servers and was called Common Gateway Interface (CGI). </li></ul><ul><li>CGI allowed Web sites to dynamically create Web pages from a program typically written in C or a scripting language such as Perl. </li></ul>
  11. 11. Dynamic Web Pages cont. <ul><li>CGI added functionality to the Web </li></ul><ul><li>CGI programs often exhausted memory space on Windows computers </li></ul><ul><li>These shortcomings eventually led to Active Server Pages, or commonly called ASP. </li></ul>
  12. 12. Dynamic Web Pages/ASP <ul><li>Active Server Pages (ASP) is a technology that allows for the generation of HTML pages that are responding to a set of instructions (dynamic) prior to being delivered to the browser. </li></ul><ul><li>ASP is not a language </li></ul><ul><li>ASP is browser independent </li></ul><ul><li>Other technologies are; </li></ul><ul><ul><li>ASP.Net. </li></ul></ul><ul><ul><li>PHP </li></ul></ul><ul><ul><li>JSP </li></ul></ul><ul><ul><li>Coldfusion </li></ul></ul>
  13. 13. But What Makes an Active Server Page Work ? Clients system Server Asp.dll Pre processing Translation to HTML Scripting Agents Execution Request HTML for display 1. Prestored instructions written by author
  14. 14. What is a web Server? <ul><li>A Web Server is made up of; </li></ul><ul><ul><li>A Server </li></ul></ul><ul><ul><li>& </li></ul></ul><ul><ul><li>Web server software </li></ul></ul><ul><li>A web server is; </li></ul><ul><ul><li>Is a computer with software that distributes web pages to users on demand </li></ul></ul><ul><ul><li>Provides a storage area and organises the pages of a web site </li></ul></ul><ul><ul><li>Can be a remote machine or your own computer </li></ul></ul>
  15. 15. What is a Web Server used for? <ul><li>Storing </li></ul><ul><ul><li>Client-side scripting </li></ul></ul><ul><ul><li>Server-side scripting </li></ul></ul><ul><li>Responding to a request. </li></ul>Server User 2. Client requests web page With the use of the web browser. 3. Server locates files 4. Html and graphics returned to user and are displayed in the browser. 1. Author writes html and graphics
  16. 16. Web Protocols uses. <ul><li>TCP </li></ul><ul><ul><li>Transport Control Protocol </li></ul></ul><ul><li>HTTP </li></ul><ul><ul><li>Hypertext Transfer Protocol </li></ul></ul>
  17. 17. TCP <ul><li>What is TCP ? </li></ul><ul><li>TCP is the protocol used by the browser to parcel up the information, (including the http request), that is required when the browser is to fetch another web page. </li></ul><ul><li>The TCP is a transport protocol, which provides a reliable transmission format for the information to be transmitted. </li></ul><ul><li>The following are the services that TCP provides; </li></ul><ul><ul><li>connection-oriented: setup required between client and server processes </li></ul></ul><ul><ul><li>reliable transport between sending and receiving process </li></ul></ul><ul><ul><li>flow control: sender won’t overwhelm receiver </li></ul></ul><ul><ul><li>congestion control: throttle sender when network overloaded </li></ul></ul><ul><ul><li>does not provide: timing, minimum bandwidth guarantees </li></ul></ul>
  18. 18. What is HTTP? <ul><li>HTTP: hypertext transfer protocol </li></ul><ul><li>Http is the protocol used by the web (www) which creates two types of messages, that are transmitted over the web using TCP ; </li></ul><ul><ul><li>Request : This message contain information about the page the user has requests. It is sent from the user/client to the web server. </li></ul></ul><ul><ul><li>Response : This message contains information that allows the user/client to view the web page they requested. The web page is contained in this message. </li></ul></ul><ul><li>The versions of HTTP </li></ul><ul><li>HTTP 1.0: RFC 1945 </li></ul><ul><li>HTTP 1.1: RFC 2068 </li></ul>
  19. 19. HTTP overview <ul><li>Uses TCP: </li></ul><ul><li>client initiates TCP connection (creates socket) to server, port 80 </li></ul><ul><li>server accepts TCP connection from client </li></ul><ul><li>HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) </li></ul><ul><li>TCP connection closed </li></ul>PC running Explorer Server running Apache Web server Mac running Navigator HTTP request HTTP request HTTP response HTTP response
  20. 20. Web and HTTP <ul><li>First some jargon </li></ul><ul><li>HTTP is “stateless” </li></ul><ul><ul><li>server maintains no information about past client requests </li></ul></ul><ul><ul><li>This allows the server to talk to many computers at the same time with limited delays. </li></ul></ul><ul><li>Web page consists of objects </li></ul><ul><li>Object can be HTML file, JPEG image, Java applet, audio file,… </li></ul><ul><li>Web page consists of base HTML-file which includes several referenced objects </li></ul><ul><li>Each object is addressable by a URL </li></ul><ul><li>Example URL: </li></ul>www.someschool.edu/someDept/pic.gif host name path name
  21. 21. HTTP 1.0: RFC 1945 <ul><li>Non-persistent HTTP </li></ul><ul><li>At most one object is sent over a TCP connection. </li></ul><ul><li>HTTP/1.0 uses non-persistent HTTP </li></ul><ul><li>Method Types </li></ul><ul><ul><li>GET </li></ul></ul><ul><ul><li>POST </li></ul></ul><ul><ul><li>HEAD </li></ul></ul>Method types put different information in the response message. We will cover the meanings of these methods later.
  22. 22. HTTP 1.1: RFC 2068 <ul><li>Persistent HTTP </li></ul><ul><li>Multiple objects can be sent over single TCP connection between client and server. </li></ul><ul><li>HTTP/1.1 uses persistent connections in default mode </li></ul><ul><li>Method Types </li></ul><ul><ul><li>GET, POST, HEAD, same as HTTP 1.0 </li></ul></ul><ul><ul><li>PUT </li></ul></ul><ul><ul><li>DELETE </li></ul></ul>
  23. 23. An Example of Nonpersistent HTTP Suppose user enters URL www.someSchool.edu/someDepartment/home.index This URL contains text and references to 10 jpeg images. Therefore there is 11 objects that must be sent to the user. An example of the steps that are taken are on the next 2 slides.
  24. 24. 1a . HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80 2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index 3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket time 1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client
  25. 25. Nonpersistent HTTP (cont.) 4 . HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects 6. Steps 1-5 repeated for each of 10 jpeg objects 5. HTTP server closes TCP connection. time
  26. 26. HTTP Request/Response Message Line <ul><li>Both messages are broken up into three sections; </li></ul><ul><ul><li>Request/response line. </li></ul></ul><ul><ul><ul><li>Contains for a Request: </li></ul></ul></ul><ul><ul><ul><ul><li>Method, eg: GET, POST </li></ul></ul></ul></ul><ul><ul><ul><ul><li>URL of the file that the client requesting. </li></ul></ul></ul></ul><ul><ul><ul><ul><li>The version number of the http. </li></ul></ul></ul></ul><ul><ul><ul><li>Contains for a Response </li></ul></ul></ul><ul><ul><ul><ul><li>HTTP version </li></ul></ul></ul></ul><ul><ul><ul><ul><li>HTTP request code </li></ul></ul></ul></ul>
  27. 27. HTTP Request/Response Message Header <ul><ul><li>HTTP header. </li></ul></ul><ul><ul><ul><li>Contains info that falls into three types </li></ul></ul></ul><ul><ul><ul><ul><li>General : contains info about client/server. </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Entity: contains info about the data being sent between client and server. </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Request: contains info about the client configuration & different types of acceptable documents. </li></ul></ul></ul></ul><ul><ul><ul><ul><li>OR </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Response: contains info about the server sending the response and how it can deal with the response. </li></ul></ul></ul></ul>
  28. 28. HTTP Request/Response Message Body <ul><ul><li>HTTP body. </li></ul></ul><ul><ul><ul><li>Contains for a Request: </li></ul></ul></ul><ul><ul><ul><ul><li>If the method is post, then the body contains any data that is being sent to the server. Eg: data from a form. </li></ul></ul></ul></ul><ul><ul><ul><ul><li>If the method is GET then the body is empty </li></ul></ul></ul></ul><ul><ul><ul><li>Contains for a Response: </li></ul></ul></ul><ul><ul><ul><ul><li>If the request is successful, then the body contains the HTML code & script, ready for the browser’s interpretation </li></ul></ul></ul></ul>
  29. 29. HTTP Request Request: GET/default.asp /HTTP://www.Wrox.com /HTTP1.1 Header: ACCEPT:*/* ACCEPT_LANGUAGE: en-us CONNECTION:Keep-Alive HOST:webdev.wrox.co.uk REFERER:http://webdev.wrox.co.uk/books/SampleList.asp?bookcode=3382 USER_AGENT:Mozilla/4.0 (compatible;MSIE 5.01;Windows NT 5.0) Body;(empty) Request line Header Body GET message Client form data
  30. 30. get request <ul><li>Sends form content as part of URL </li></ul><ul><li>Retrieves appropriate resource from Web server </li></ul><ul><li>Limits query to 1024 characters </li></ul><ul><li>The ? The start of the query string and is used to separate each Key-value pair. </li></ul><ul><li>The key-value pair consists of the variable name and the value of the variable. </li></ul><ul><li>In the example below the variable name is called name and the value is 2. </li></ul>URL Query String Key-value pair
  31. 31. post request <ul><li>Updates contents of Web server (posting new messages to forum) </li></ul><ul><li>Unlike the get has no limit for length of query </li></ul><ul><li>Not part of URL and cannot be seen by user </li></ul>
  32. 32. Accessing Web Servers <ul><li>Requesting documents </li></ul><ul><ul><li>You must know the machine name on which the Web server resides. This can be done by the following; </li></ul></ul><ul><ul><li>Through local Web servers </li></ul></ul><ul><ul><ul><li>Or </li></ul></ul></ul><ul><ul><ul><li>remote Web servers </li></ul></ul></ul><ul><ul><li>OR </li></ul></ul><ul><ul><li>Through domain name or Internet Protocol (IP) address </li></ul></ul>
  33. 33. Local Web server <ul><li>Resides on users’ machines </li></ul><ul><li>Requests documents in two ways </li></ul><ul><ul><li>Machine name </li></ul></ul><ul><ul><li>localhost </li></ul></ul><ul><ul><ul><li>Host name that references local machine </li></ul></ul></ul><ul><li>Does not strictly belong to hierarchy </li></ul><ul><li>Each ISP (residential ISP, company, university) has one. </li></ul><ul><ul><li>Also called “default name server” </li></ul></ul><ul><li>When a host makes a DNS query, query is sent to its local DNS server </li></ul><ul><ul><li>Acts as a proxy, forwards query into hierarchy. </li></ul></ul>
  34. 34. Domain name <ul><li>Represents a group of hosts on Internet </li></ul><ul><li>Combines with show name ( www ) and top-level domain to form a fully qualified host name </li></ul><ul><li>Top-level domain (TLD) </li></ul><ul><ul><li>Describes type of organization that owns domain name and its’ country of origin. </li></ul></ul><ul><ul><ul><li>.com or .org or .net.au </li></ul></ul></ul><ul><li>Fully qualified host name </li></ul><ul><ul><li>Provides user friendly way to identify site on Internet </li></ul></ul>Root DNS Servers com DNS servers org DNS servers edu DNS servers poly.edu DNS servers umass.edu DNS servers yahoo.com DNS servers amazon.com DNS servers pbs.org DNS servers
  35. 35. SOAP
  36. 36. What is SOAP? <ul><li>SOAP provides the envelope for sending Web Services messages over the Internet/Internet.  </li></ul><ul><li>SOAP at one time stood for Simple Object Access Protocol. Starting with SOAP Version 1.2, the letters in the acronym have no particular meaning. </li></ul><ul><li>SOAP commonly uses HTTP, but other protocols such as Simple Mail Transfer Protocol (SMTP) may by used. </li></ul><ul><li>SOAP can be used to exchange complete documents or to call a remote procedure. </li></ul>
  37. 37. What is SOAP? <ul><li>The envelope contains two parts: </li></ul><ul><li>An optional header providing information on authentication, encoding of data, or how a recipient of a SOAP message should process the message. </li></ul><ul><li>The body that contains the message. These messages can be defined using the WSDL specification. </li></ul>
  38. 38. What is SOAP? <ul><li>A SOAP envelope can contain any XML data, just as an HTTP envelope can contain any data in its entity-body. </li></ul><ul><li>In every existing SOAP envelope contains a description of an RPC call in a format similar to that of XML-RPC. </li></ul>
  39. 39. Message Service Specification (MSS) The MSS contains two parts: Header container . This is the first MIME part, containing One SOAP message. The SOAP message is an XML document consisting of a SOAP Envelope element. The SOAP Envelope element consists of: SOAP-ENV:Header. This is a generic mechanism for adding features to SOAP message, including ebXML specific header elements. SOAP-ENV:Body. This is a container for message service handler control data and information related to the payload parts of the message.  Payload containers. There can be zero or more additional MIME parts containing application specific payloads.
  40. 40. Advantages of SOAP <ul><li>Using SOAP over HTTP allows for easier communication behind proxies and firewalls than previous remote execution technology. </li></ul><ul><li>SOAP is versatile enough to allow for the use of different transport protocols. The standard stacks use HTTP as a transport protocol, but other protocols are also usable (TCP, SNMP). </li></ul>
  41. 41. Disadvantages of SOAP <ul><li>Because of the verbose XML format, SOAP can be considerably slower than competing middleware technologies such as CORBA . This may not be an issue when only small messages are sent. </li></ul><ul><li>On the other side, SOAP has Message Transmission Optimization Mechanism . </li></ul><ul><li>When relying on HTTP as a transport protocol and not using WS-Addressing or an ESB , the roles of the interacting parties are fixed. Only one party (the client) can use the services of the other. So developers must use polling instead of notification in these common cases. </li></ul>
  42. 42. Some Resources <ul><li>http://en.wikipedia.org/wiki/Http </li></ul><ul><li>http://www.cs.cf.ac.uk/Dave/node33.html </li></ul><ul><li>http://www.15seconds.com/issue/031209.htm </li></ul><ul><li>http://www.w3schools.com/Schema/default.asp </li></ul>