A RESTful Interface to a Mobile Phone
Jari Kleimola
Helsinki Institute for Information Technology (HIIT), Ubiquitous Interaction Group
P.O.Box 9800, FI-02015, Helsinki University of Technology, Finland
jari.kleimola@hiit.fi
ABSTRACT scalable and stateless middleware layer between the mobile phone
A web server running on a mobile phone can provide access to and accessing clients (see top of fig. 1). Clients include browsers,
embedded functionality, personal context and shared user data of widely used desktop applications, widgets, mashups, web
the phone. When considering the versatility and distinct features services, and other networked devices. Additionally, as REST and
of modern phone models, it may seem that dedicated client XML are already generally accepted techniques, it is possible to
applications are required to consume that information. This reuse and enrich the functionality of the existing clients in a non-
demonstration abstract shows how a thin middleware layer atop intrusive way. The interface enables also previously unrealized
the mobile web server can expose the data and functionality of a scenarios.
mobile phone to existing, widely used third party applications.
This can be done non-intrusively, i.e., without modifications in
existing client code base, enabling both reuse and enrichment
through novel context aware scenarios.
Categories and Subject Descriptors
D.2.12 [Software Engineering]: Interoperability; D.2.13
[Software Engineering]: Reusable Software; D.2.11 [Software
Engineering]: Software Architectures; C.2.4 [Computer-
Communication Networks]: Distributed Systems.
Figure 1. System Architecture. The demonstrated interface is
General Terms highlighted with gray background.
Algorithms, Design, Languages, Standards
Section 2 of this abstract describes the enablers, architecture and
Keywords operation of the system, and discusses briefly also application
modeling issues. Section 3 outlines the demonstration. Foreseen
mobile phone, server, middleware, REST
benefits are listed finally in section 4.
1. INTRODUCTION 2. SYSTEM DESCRIPTION
A recent demonstration showed that mobile phones are capable of
hosting content management system (CMS) powered web sites 2.1 Enablers
[1]. This allows easier configuration and publication of content CMS-powered websites of [1] were enabled by porting the AMP
that combines traditional web site functionality with the context solution stack (comprising Apache web server, MySQL database
aware nature and personal aspects of mobile devices. The user and PHP scripting support, cf. fig. 1) to Symbian S60 platform
experience to these web sites is given through remote or local web [2]. Representational State Transfer (REST) models applications
browsers. as uniquely addressable resources that can be manipulated using a
sparse and uniform set of operations [3]. The fractional state, or
While mobile CMS web sites certainly enable exciting and novel partial view of the application, is defined by a dynamic set of
application scenarios, there are use cases that would benefit of a resources, which changes as the result of issued operations.
more lightweight or lower level interface to the embedded server. Stateless and cacheable networking protocol is used as the
First, browsers are not the only user agents to access the mobile communication channel between the client and the server. The
web server. As local desktop applications are increasingly more transferred payload (i.e., resources) is often represented as
network aware, and as the number of web services, mashups and hierarchical structures with attributes defining the state of a
widgets is still rapidly rising, a widely accepted API to the resource, thereby permitting a variety of XML-based languages to
dynamic context and personal content of a mobile phone would be be used for the description and information exchange format.
a useful asset. Likewise, other components of the ubiquitous
environment (like public space displays) might also profit from
such an interface. Second, because the functionality and scope of 2.2 Architecture and Operation
use of a high-end mobile phone is quite versatile, there should be The demonstrated RESTful interface is bound to HTTP protocol,
an API that provides uniform and scalable access to the phone so it uses four verbs for operations: GET to fetch, PUT to update,
services and resources. The interface should also be stateless in POST to add, and DELETE to remove resources. Resources are
order to support the multitasking character of the platform. addressed using URIs, and the content is represented as plain
XML, XHTML, as different RSS variants, or as another (binary)
This demonstration shows how RESTful architectural style and content type. The interface does not currently utilize the MySQL
XML-based content can be combined into a thin, uniform, component of the AMP stack.
The operation cycle starts with a RESTful request, issued by an ubiquitousness of the utilized techniques, interoperability and
external client, and ends with a reply from the phone server. The reuse of existing client implementations is achiveced in a non-
request consists of a verb and URI (e.g., GET /phone/inbox), an intrusive manner. Finally, by further taking advantage of the
optional tail defining preferred reply format (e.g., ?format=rss), context awareness of the mobile phone, novel scenarios can be
and an optional content body. The reply contains the status code realized at the application level, even without any extra
of the operation, and in case of GET, a fetched representation of implementation efforts.
the resource (e.g., a list of messages of inbox). Each returned
resource is supplied with its URI for further addressing tasks, as
there is no server side state maintenance between two requests.
5. ACKNOWLDEGEMENTS
The author would like to thank J.K. Nurminen and J. Wikman for
The main interface logic is implemented as three PHP classes valuable support and comments throughout this work.
(Dispatcher, Resource, Transformer, cf. fig. 1), while each
resource type has its own implementation class derived from the 6. REFERENCES
Resource. Apache parses the URI and routes the request to a [1] Nurminen, J.K., Wikman, J., Kokkinen, H., Muilu, P. and
resource sub-class, which initiates a three-stage pipeline process: Grönholm, M. 2008. Drupal Content Management System on
Dispatcher examines the request verb, invokes a respective Mobile Phone. In Proc. of the 5th IEEE Consumer
handler method in the Resource derivative, which then executes Communications and Networking Conference (Las Vegas,
the request. If the result has XML content, the Transformer class NV, USA, Jan. 10 - 12, 2008). CCNC 2008. IEEE, 1228-
translates the raw XML into client-preferred format that is finally 1229. DOI=
returned to the external client as a response. http://doi.ieeecomputersociety.org/10.1109/ccnc08.2007.281
[2] Wikman, J., Nurminen, J.K., Kokkinen, H., Muilu, P. and
2.3 Modeling Issues Heikelä, M. 2008. Mobile Web Application Development
The phone platform and its API uses treelike constructs for the Stack. In Proc. of the 5th IEEE Consumer Communications
application model (e.g., inbox messages, media folders, contact and Networking Conference (Las Vegas, NV, USA, Jan. 10 -
classes), which matches nicely with the URI-form addressing and 12, 2008). CCNC 2008. IEEE, 1246-1247. DOI=
XML-based replys. The interface models the entire functionality http://doi.ieeecomputersociety.org/10.1109/ccnc08.2007.291
of the phone as container-item hierarchies, and represents state
variables as attributes. [3] Fielding, R.T. 2000. Architectural Styles and the Design of
Network-based Software Architectures. Doctoral Thesis.
Treelike form contributes also to the scalability of the model, as it University of California, Irvine. Available at
is easy to add branches for increased functionality. The system http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
would be even more scalable, should the native phone API (accessed May 13, 2008).
support DOM and XSLT transformations. Presently, Transformer
class utilizes PHP string operations, which clearly is not the
preferred way.
3. DEMO OUTLINE
The demonstration shows how the interface exposes selected
resources of a smartphone, and allows several unmodified third
party clients (e.g., Outlook, iTunes, Yahoo Widgets, PicLens,
Google Photos Screensaver) to access them via simple RESTful
requests. The demonstration includes a number of diverse
application scenarios for browsers, desktop applications, widgets,
mashups, and portable devices. Symbian S60 is used as the
mobile server platform.
4. CONCLUSION
We find several benefits in the interface that could be transferred
into ubiquitous environments. First, simplicity of the RESTful
interface results into manageable lightweight implementations.
The native procedural and object oriented mobile phone API
could be exposed by utilizing just four uniform operations within
a tree-form model. Second, because the URI namespace is truly
expandable (as has been proved by the www), the interface scales
very well into variable-sized and dynamic usage scenarios. These
two points are further enforced by the stateless and platform
independent communication protocol. Third, because of the