SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery Web Services A web service is a software system that supports interaction (requesting data,

Slides:



Advertisements
Similar presentations
HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
Advertisements

1 HTTP and some other odds and ends Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
CS320 Web and Internet Programming Generating HTTP Responses
Application Layer Socket API, HTTP, VoIP, DNS IS250 Spring 2010 John Chuang.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
How the web works: HTTP and CGI explained
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Know how HTTP accesses data on the WWW Objectives.
CS 142 Lecture Notes: HTTPSlide 1 HTTP Request GET /index.html HTTP/1.1 Host: User-Agent: Mozilla/5.0 Accept: text/html, */* Accept-Language:
Hypertext Transport Protocol CS Dick Steflik.
Nikolay Kostov Telerik Corporation
Lecture 4: stateful inspection, advanced protocols Roei Ben-Harush 2015.
Rensselaer Polytechnic Institute CSC-432 – Operating Systems David Goldschmidt, Ph.D.
MEC /19/2017 7:51 PM © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
University of Calgary – CPSC 441 Parts of these slides are courtesy of Erich Nahum (IBM Research)
Network Protocols: Design and Analysis Polly Huang EE NTU
ECE Prof. John A. Copeland Office: Klaus or call.
Basics of the HTTP Protocol and Apache Web Server Brandon Checketts.
Web technologies and programming cse hypermedia and multimedia technology Fanis Tsandilas April 3, 2007.
COMP3016 Web Technologies Introduction and Discussion What is the Web?
Java Technology and Applications
HTTP Protocol Specification
HTTP HTML Introduction to web development. elaborate SPARCS 07 Wheel Moodle TA 안병욱 CS101 TA The presenter is 바퀴짱 ? 3 월 신작 ? 밤의 제왕 ? 악명 높은 TA?
HTTP Reading: Section and COS 461: Computer Networks Spring
HyperText Transfer Protocol (HTTP).  HTTP is the protocol that supports communication between web browsers and web servers.  A “Web Server” is a HTTP.
CSC 2720 Building Web Applications Getting and Setting HTTP Headers (With PHP Examples)
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
CS 190 Lecture Notes: Tweeter ProjectSlide 1 Uniform Resource Locators (URLs) Scheme Host.
REST.  REST is an acronym standing for Representational State Transfer  A software architecture style for building scalable web services  Typically,
WWW, HTTP, GET, POST, Cookies Svetlin Nakov Telerik Corporation
IT Engineering Instructor: Rezvan Shiravi
The HyperText Transfer Protocol. History HTTP has been in use since 1990 (HTTP/0.9) HTTP/1.0 was defined in RFC 1945 (May 1996) and included metainformation.
1 Introductory material. This module illustrates the interactions of the protocols of the TCP/IP protocol suite with the help of an example. The example.
Proxy Lab Recitation I Monday Nov 20, 2006.
Web Server Design Week 8 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/3/10.
HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.
Web Server Design Week 4 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/03/10.
1-1 HTTP request message GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0 Connection: close Accept-language:fr request.
Part 2 – WWW and HTTP Nikolay Kostov Telerik Corporation
CITA 310 Section 2 HTTP (Selected Topics from Textbook Chapter 6)
The Basics of HTTP Jason Dean
Web Technologies Lecture 1 The Internet and HTTP.
JavaScript, Part 4 Instructor: Charles Moen CSCI/CINF 4230.
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
EE 122: Lecture 21 (HyperText Transfer Protocol - HTTP) Ion Stoica Nov 20, 2001 (*)
Summer 2007 Florida Atlantic University Department of Computer Science & Engineering COP 4814 – Web Services Dr. Roy Levow Part 1 – Introducing Ajax.
5 th ed: Chapter 17 4 th ed: Chapter 21
Overview of Servlets and JSP
LURP Details. LURP Lab Details  1.Given a GET … call a proxy CGI script in the same way you would for a normal CGI request  2.This UDP perl.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 7 Omar Meqdadi Department of Computer Science and Software Engineering University of.
COMP2322 Lab 2 HTTP Steven Lee Jan. 29, HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):
Performance testing and engineering Raja Gourav Kokkiligadda, Performance Architect, Domestic and General.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
DEV336. demo HTTP Packet Trace GET / HTTP/1.1 Accept: text/html, application/xhtml+xml, */* Accept-Language: en-US User-Agent: Mozilla/5.0 (compatible;
How to consume a RESTful service using jQuery. Introduction  In this post we see how to consume the RESTful service described in the post Design a RESTful.
Troubleshooting web sites with web browsers LIR HEAnet User Group for Libraries DCU June 7 th 2016
REST API Design. Application API API = Application Programming Interface APIs expose functionality of an application or service that exists independently.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
Fiddler and Your Website Robert Boedigheimer. About Me Web developer since 1995 Columnist for aspalliance.com Pluralsight Author 3 rd Degree Black Belt,
Lecture 4: Stateful Inspection, Advanced Protocols.
DOM, jQuery, AJAX, REST Using Kinvey as JS Back-End
National College of Science & Information Technology.
6.033 Lecture 24 Protocols and Authorization Nickolai Zeldovich Spring 2009.
Martin Kruliš by Martin Kruliš (v1.1)1.
HTTP – An overview.
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.
HTTP Protocol.
HTTP, RESTful Web Services, HTTP and REST Tools: Postman, Fiddler

CSCI-351 Data communication and Networks
Presentation transcript:

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery Web Services A web service is a software system that supports interaction (requesting data, sending data) with other software over a network. A web service hosted at a particular URL can be configured to accept requests from: Web pages under the same domain Web pages on different domains Android/iOS Windows, UNIX Other software

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery Web Services Web services provide the benefit of multiple software systems being able to access the same data in the same way. HTTP Request Process Request HTTP Response

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery HTTP Request Example request header: GET /apps/blogs/news/category/news HTTP/1.1 Host: sunypoly.edu Connection: keep-alive Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp, */*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/ (KHTML, like Gecko) Chrome/ Safari/ Referer: Accept-Encoding: gzip, deflate, sdch Accept-Language: en-US,en;q=0.8 See this in Google Chrome's developer tools by clicking the Network tab, selecting a request, then Headers at the bottom

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery HTTP Request Verb: Some possible values: GET, PUT, POST, DELETE URI: /apps/blogs/news/category/news HTTP Version: HTTP/1.1 Host: Host: sunypoly.edu

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery HTTP Response Example request header: HTTP/ OK Server: nginx Date: Mon, 30 Mar :08:52 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.6.3 Expires: Thu, 19 Nov :52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache X-Pingback: X-Custom-loc: /root/ Content-Encoding: gzip

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery HTTP Status Codes Full list here: 2xx – Success 200 – OK 3xx – Redirect 301 – Moved Permanently 302 – Found 4xx – Error 403 – Forbidden 404 – Not Found 408 – Request Timeout 500 – Internal Server Error 503 – Service Unavailable

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery RESTful Services Over time there have been different kinds of web services. The current standard is REST: REST = Representational State Transfer REST encourages web services to be designed as scalable, maintainable, and with network performance in mind.

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery RESTful Services RESTful services provide access to resources. This could be any kind of information. These resources can be represented as XML or JSON. When using REST services for web pages, JSON is most commonly used. JSON Representation of a single object: { "ID": "1", "FirstName": "John", "LastName": "Smith", "Birthdate": " " }

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery RESTful Services JSON Representation of a list (array) of objects: [ { "ID": "1", "FirstName": "John", "LastName": "Smith", "Birthdate": " " }, { "ID": "2", "FirstName": "Jane", "LastName": "Doe", "Birthdate": " " } ]

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery RESTful URIs Pattern: Example – All animals Example – Animal by ID

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryAJAX Use AJAX (Asynchronous JavaScript and XML) to send a request to a web service. Asynchronous: Do not wait for the service to return results; Continue with the next logical step in the code. JavaScript: Use JavaScript (or jQuery, since it's really JavaScript) to send the request. XML: Web services commonly return data as either XML or JSON. Even though JSON is more commonly used now, we're not renaming AJAX.

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery jQuery AJAX jQuery provides multiple convenient functions to make AJAX requests. The two we will look at are $.ajax() and $.get() $.get(“ function (data) { … }); is shorthand for: $.ajax({ url: data: “{JSON formatted arguments go here, if any}”, success: function (data) {... }, dataType: dataType });

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryCallbacks A callback is a function that is called automatically at a later time. When making an AJAX request, you usually will setup callback functions for when the request is successful & returns data and for when the request errors. The callback functions will not be called until the AJAX request returns a result.

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery AJAX Callbacks $.get( "URL_To_Service" ).done(function(data) { alert( "success" ); }).fail(function() { alert( "error" ); }).always(function() { alert( "complete" ); });

SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQuery Passing Functions as Arguments This example is from the jQuery documentation: Wrong $.get( "myhtmlpage.html", myCallBack( param1, param2 ) ); Right $.get( "myhtmlpage.html", function() { myCallBack( param1, param2 ); });