In this post I will try to give you a schematic overview of technologies, principles and protocols and how they relate to each other. The ones that I will describe are AJAX, JSON, REST, SOAP and JQUERY. I will also add a staccato description of these for dummies and maybe if I have some time left I will add an example. So let’s start with the nice picture! ;-) AJAX• PRESENTATION: HTML  or XHTML and CSS
• DYNAMIC DISPLAY AND INTERACTION: Document Object Model and JavaScript
• EXCHANGE OF DATA AND MANIPULATION: XML and XSLT, also JSON possible
• ASYNCHRONOUS COMMUNICATION: XMLHttpRequest
• GLUE: JavaScript (sometimes VBScript)
• COLLECTION: of technologies JSON• INTERCHANGE OF DATA: lightweight text-based format, alternative to XML
• BASIC TYPES: String, Integer, Boolean, Array and Objects
• VERIFICATION: goes trough JSON Schema to verify the contents of an object
• SAME ORIGIN POLICY: the reply must come from the same DNS domain as where the request was made. JSONP / JavaScript / JSONRequest are workarounds.
• SECURITY CONCERNS: returning script instead of JSON data. Workaround: use a JSON parser. Unless browser supports native JSON like IE8, Firefox 3.5, Opera 10.5, Chrome, Safari. Else, use libraries like JQUERY
• ALTERNATIVES: XML although XML tends to be larger
• DISADVANTAGES: no binary representations possible, unless encoded as text, no standard path notation like XPath. REST• PRINCIPLE: an application can interact with a resource by knowing the identifier of the resource and the action required like GET, PUT or DELETE. The resource returns a representation of the requested data which can be HTML, XML, JSON etc.
• ARCHITECTURE: REST is an architecture and is not a standard.
• CLIENT-SERVER: clients are separated by the server. Clients don't care about data storage, servers don't care about presentation.
• STATELESS: any state is held in the client. Client context is not stored on the server.
• CACHEABLE: responses may be cached
• UNIFORM ARCHITECTURE: between client and servers decouples the architecture. Each one can evolve on its own.
• SECURITY RISKS: Code on Demand by returning java applets or JavaScript.
• RESTFUL WEB SERVICE: a simple web service using HTTP and using the principles or REST. The web service is built around the URI to the resource, the MIME type of the data supported by the web service and the ACTION like put, get, delete and post.
• FRAMEWORK IMPLEMENTATIONS: MS WCF Data Services, PHP Symphony and many others
• ALTERNATIVE: SOAP which is a protocol, not an architectural principle SOAP• PROTOCOL: to exchange data in a structured manner, providing a basic messaging framework upon web services can been built.
• ALTERNATIVE: built RESTful web service as these correctly make use of the HTTP defined methods JQUERY• FRAMEWORK: JavaScript framework to manipulate DOM, CSS and to communicate with SERVER (AJAX)
• CHARACTERISTICS: work with DOM cross browser with support of CSS 1.3. Use of events, effects, AJAX and is extensible. Example <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Show content from page</title>

<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() {

$.getJSON("http://yourserver/_vti_bin/ListData.svc/Pages/",function(data) {

var count = 0;
$.each(data.d.results, function(i,result) {
var title = result.Title;
html = "<table border='0' style='float: left'>
<tr><td style='color:blue'>" + title +"</td></tr>
</table>";
$('#resultarea').append($(html));
});
});
});

</script>

</head>
<body>
<div id="resultarea">
</div>
</body>
</html>
In the example as shown above I have demonstrated how to call a RESTful webservice, the listdata.svc from SharePoint, get data through an asynchronous call, get back JSON data and use JQuery to display it. All of course done using AJAX technologies.


Discuss   Add this link to...  Bury

Comments Who Voted Related Links