Rest-Based Web Access To Learning Design Services: Juan Manuel Dodero and Ernie Ghiglione
Rest-Based Web Access To Learning Design Services: Juan Manuel Dodero and Ernie Ghiglione
Rest-Based Web Access To Learning Design Services: Juan Manuel Dodero and Ernie Ghiglione
INTRODUCTION
VOL. 1,
NO. 3,
JULY-SEPTEMBER 2008
VOL. 1,
NO. 3,
JULY-SEPTEMBER 2008
Fig. 1. View of activities, resources, and services of the IMS LD information model.
2.1
191
2.2
2.3
192
VOL. 1,
NO. 3,
JULY-SEPTEMBER 2008
2.
3.
4.
5.
3.1
VOL. 1,
NO. 3,
JULY-SEPTEMBER 2008
3.2
3.3
The ReST API that results from mapping the service operation to
ReSTful URIs (methodology step 3) is described in Table 1. ReSTful
URIs provide a simple and standard syntax to describe User-Page
and Page-PageVersion relationships of the object model, such that
any operation invocation can be easily generated from that model
as an HTTP method call. For example, the get_page_versions
(page_id) operation retrieves all versions of a given page; to
implement a ReSTful call to this service, the URI /pages/:page_id/
versions is formed; parts of the URI prefixed with a colon stand for
the actual values of the operation arguments. Therefore, all
resources of the wiki (i.e., users, pages, and page versions) can
be uniformly named, accessed, and addressed out of the service
provider through common HTTP requests.
One advantage of this approach is that it provides a fine-grained
access to the resources that compound the wiki service. Instead of
having a single coarse-grained URL to access the overall service,
component objects of the service (i.e., users, pages, and page
versions) are visible and can be navigated from the LD. Another
advantage of ReST style is that the format to deliver the output of
the service invocation is specified by appending .xml, .html, or
any other desired suffix to the URI. For instance, /pages/32/
edit.iphone would deliver a form to edit the page with id 32 on an
iPhone. This enables the interconnection of resources required to
navigate from one LD activity to another, and it can do it for a
diversity of delivery formats and user devices.
3.4
193
their complete API through ReST. For example, JotSpot API can
handle tags and attachments, but its reduced ReST version does
not include such resource types. In such cases, they are marked
with a dot. Although resource objects have methods that
implement the service operations, these have not been described
as part of the table.
Then, we explored how wiki services are accessed from an LD
activity. The activity client interface has been developed with
Google Web Toolkit (GWT). The following code listing shows how
the get_page (page_id) service operation is implemented to enable
retrieving a wiki page from the activity:
class PageResource implements Resource {
List pageVersions;
String jsonRepresentation;
public void PageResource() {
populateFromRepresentation(jsonRepresentation);
}
//. . .
}
class Wiki extends Composite implements WikiFacade {
public void get_page(int page_id) {
//. . .
ResourceCollection pages =
new JsonResourceCollection(
"http://" SERV_PROVIDER GET_PAGE_CMD,
new ResourceFactory() {
public Resource create() {
return (Resource)
GWT.create(PageResource.class);
}
});
pages.find(page_id,
new ResourceResponseHandler() {
public void onSuccess(Resource resource) {
// Display page
String title =
((ProjectResource)resource).getName());
// . . .
}
public void onError(Request request,
Throwable exception) {
Window.alert("Page not found.");
}
});
}
//. . .
}
The program code shows how different service providers can
be integrated. First, the constant SERV_PROVIDER is configured
with the hostname of the wiki application provider (i.e., DekiWiki,
SpringNote, or JotSpot). Second, GET_PAGE_CMD holds the
ReST-style command for retrieving the pages. According to ReST
principles, it should be the string pages, but it can be configured
for any provider that does not fully comply with ReST vocabulary
(e.g., listAll retrieves all pages in JotSpot). The rest of the details of
the request (e.g., the page id) are uniformly coded in the method
ResourceCollection.find. Therefore, adapting the client access
interface from the LD activity to the learning service is as
straightforward as configuring the URI access point to the resource
and the ReST-based verb vocabulary. This way, ReST facilitates
194
VOL. 1,
NO. 3,
JULY-SEPTEMBER 2008
TABLE 1
Mapping the Wiki Service Operation to ReSTful URIs
TABLE 2
Resource Objects Available through DekiWiki, SpringNote, and JotSpot APIs
ACKNOWLEDGMENTS
This work was supported in part by the Plan Nacional de
Investigacion Cientfica, Desarrollo e Innovacion Tecnologica,
Projects TSI-020301-2008-19 and TSI-020501-2008-53.
REFERENCES
[1]
[2]
[3]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
VOL. 1,
NO. 3,
JULY-SEPTEMBER 2008
195