Communication & Ajax

Introduction

OpenSyllabus Client needs to interact with the Sakai's Server. OpenSyllabus used all the Sakai's platform services we needed, in addition of our own services.

RPC

RPC (Remote Procedure Call) is the Ajax workhorse of GWT.
GWT offers an easy-to-use RPC mechanism that makes it easy for the client-side code and the server-side code to communicate Java objects (serialized objects) back and forth using standard HTTP.

RPC

Remote procedure call (RPC) is a communication technique used in distributed client-server architecture which allows a program to cause a subroutine to be executed remotely on another computer. That said, the remote subroutine is written like a local one, avoiding the details of the interaction with the network.

Note : Remote Method Invocation (RMI) can be considered as refering to a particular implementation of RPC in Java.

In server mode, GWT provides automatic serialization of the request and automatic deserialization of the response from the server.

So, to communicate from our GWT web client to the Sakai's web server, we have just need to define serializable POJOS

In fact, OpenSyllabus server used GWT special RPC GWT servlets to implement exchange of serialized Models Objects with the client application.

Furthermore, OpenSyllabus could load complex data from the server by leveraging the GWT XML and JSON libraries.

REST based SData

OpenSyllabus Client uses REST based calls to SData (Sakai's Data) services on the Sakai server.

For example, OpenSyllabus uses it to create or read data from the Sakai's resources repository

REST

REST (Representational State Transfer) is based on resources where each is referenced by a unique identifier, its URI (Uniform Resource Identifier). In REST, clients and servers communicate via standard HTTP and exchange representations of resources (the documents).

Thus, Sakai's SData services return JSON (JavaScript Object Notation) documents which are directly evaluated into Javascript objects by the browser.

SData Documentation

The SData service is called via a REST Servlet in Sakai. SData allows data exchanges in JSON format of information about site, resource, etc.) In order to parse JSON in GIT we have used the JSONParser from the GWT library.

Basic communication techniques

GWT also offers more basic communication techniques, including the standard Ajax asynchronous HTTP request to load simple text or HTML from the server.

Communication architecture