DOC PREVIEW
UW-Madison CS 640 - Lecture 14

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Web ServicesCS 640, Lecture 14Lecture outlinez Web Servicesz AJAXz Presentation layer for RPCWhat do web services do?z Main use: ask another computer to run a procedure for you – parameters and results sent over networkz Remote Procedure Calls (RPC) -- a very old and very powerful ideaz Distinguishing features of web servicesz They run over httpz They use XML to encode responses (and requests)z Client and server often use different languagesz Client and server are often in different organizationsz Client may be JavaScript code in browser – AJAX2More on web servicesz Many companies allow access to their data / services through web services (some free)z Examples: Amazon, ebay, Google, Yahoo, USPSz Two popular flavorsz SOAP – requests are in XMLz REST – request format same as query strings of HTML forms (sequence of name-value pairs)z WSDL (web service description language) file used to describe format of messages supported by a given web serviceASP.NET and web servicesz Writing web servicesz Create new web site of type “web service”z Write C# methods exposed to clientsz The system does the rest (incl. generating WSDL)z Using web servicesz Add “web reference” to your site/projectz Give URL of WSDL filez Use web service in your codez System adds “glue” – class definitions, code for building requests and parsing responses, etc.3Lecture outlinez Web Servicesz AJAXz Presentation layer for RPCWhat is AJAX?z Dynamic, interactive web pages that feel more like a desktop application than a static pagez Key technologies – Asynchronous requests, JavaScript, DOM manipulation, CSS (especially positioning of elements), web services using XMLz Core tenet – in response to user actions, do not refresh full page from server, send small requests as needed and update individual elements of web pagez Examples: dragging/zooming maps at Google and Yahoo, “tooltip details” at Netflix, etc. The XMLHttpRequest objectvar xmlHttp;function createXMLHttpRequest() {if (window.ActiveXObject) {return new ActiveXObject("Microsoft.XMLHTTP");} else if (window.XMLHttpRequest) {return new XMLHttpRequest();}}function do_liveSearch(pattern) {xmlHttp = createXMLHttpRequest();xmlHttp.onreadystatechange = handleStateChange;xmlHttp.open("GET",document.URL.substring(0,document.URL.lastIndexOf("/"))+"/SearchService.aspx?pattern="+pattern, true);xmlHttp.send(null);}function handleStateChange() {if(xmlHttp.readyState == 4) {if(xmlHttp.status == 200) {updatePage();} else {alert("Status "+xmlHttp.status);}}}… // var xmlDoc = xmlHttp.responseXML;LiveSearch.js4Lecture outlinez Web Servicesz AJAXz Presentation layer for RPCPresentation Formatting z Marshalling (encoding) application data into messagesz Unmarshalling (decoding) messages into application dataz Data types we considerz integersz floatsz stringsz arraysz structsz Types of data we do not considerz images z videoz multimedia documentsApplicationdataPresentationencodingApplicationdataPresentationdecodingMessage Message Message■■■Difficultiesz Representation of base typesz floating point: IEEE 754 versus non-standard z integer: big-endian versus little-endian (e.g., 34,677,374)z Compiler layout of structures(126)(34)(17)(2)00000010Big-endianLittle- endian(2)(17)(34)(126)LowaddressHighaddress001111110000100100001 001 0000100100001 001 000 000 01001111115Taxonomyz Data typesz base types (e.g., ints, floats); must convertz flat types (e.g., structures, arrays); must packz complex types (e.g., pointers); must linearizez Conversion Strategyz canonical intermediate formz receiver-makes-right (an N x N solution) Argument marshallerApplication data structureTaxonomy (cont)z Tagged versus untagged dataz Stubsz compiled z interpreted type =INTlen = 4 value = 417892Call PClientstubRPCArgumentsMarshalledargumentsInterfacedescriptor forprocedure PStubcompilerMessageSpecificationPServerstubRPCArgumentsMarshalledargumentsCode CodeeXternal Data Representation (XDR)z Defined by Sun for use with SunRPCz C type system (without function pointers)z Canonical intermediate formz Untagged (except array length)z Compiled stubs6#define MAXNAME 256;#define MAXLIST 100;struct item {int count;char name[MAXNAME];int list[MAXLIST];};bool_txdr_item(XDR *xdrs, struct item *ptr){return(xdr_int(xdrs, &ptr->count) &&xdr_string(xdrs, &ptr->name, MAXNAME) &&xdr_array(xdrs, &ptr->list, &ptr->count,MAXLIST, sizeof(int), xdr_int));}Count NameJO37 HNSONList3 497 2658321Abstract Syntax Notation One (ASN-1)z An ISO standard z Essentially the C type systemz Canonical intermediate formz Taggedz Compiled or interpretted stubsz BER: Basic Encoding Rules(tag, length, value)valuetype typelength valuelengthtype valuelengthINT 4 4-byte integerNetwork Data Representation (NDR)z Defined by DCE (CORBA)z Basically the C type systemz Receiver-makes-right (architecture tag) z Individual data items untaggedz Compiled stubs from IDLz 4-byte architecture tagz IntegerRepz 0 = big-endianz 1 = little-endianz CharRepz 0 = ASCIIz 1 = EBCDICz FloatRepz 0 = IEEE 754z 1 = VAXz 2 = Crayz 3 = IBMIntegrRep048 16 24 31FloatRepCharRep Extension 1 Extension


View Full Document

UW-Madison CS 640 - Lecture 14

Documents in this Course
Security

Security

21 pages

Mobile IP

Mobile IP

16 pages

Lecture 7

Lecture 7

36 pages

Multicast

Multicast

38 pages

Load more
Download Lecture 14
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 14 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 14 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?