RestThing: A Restful Web Service Infrastructure for Mash-up Physical and Web Resources
1. RestThing: A Restful Web Service
Infrastructure for Mash-up Physical
and Web Resources
Weijun Qin, Qiang Li, Limin Sun, Hongsong Zhu, Yan Liu
Institute of Software, Chinese Academy of Sciences
School of Software and Microelectronics, Peking University
qinweijun@is.iscas.ac.cn
24th, Oct. 2011
2011-11-12
2. OUTLINE
• Introduction
• Related Works
• RestThing Architecture
• The Prototyping Implementation
• Evaluation
• Conclusion and Future Works
2011-11-12
3. Context
Web 2.0 is changing the world!
The Concept of Web-as
participation-platform
Search Tags
Links Signals
Authoring Extensions
4. Context
Web 2.0 is changing the world!
Wikipedia is an existing application, where
each peer contributor can participate into Facebook provides APIs for third party to
and edit create new and appealing application
5. Web of Things
• Various physical things
embedded in various
industries
– RFID, barcode
– Wireless
Sensors/Actuators
Networks
– M2M devices
• If physical things are
exploited as like the
Web, new physical-
virtual applications are
created!
6. Web of Things
• Various physical things
embedded in various
industries
– RFID, barcode
– Wireless
Sensors/Actuators Web of Things
Networks
– M2M devices
• If physical things are
exploited as like the
Web, new physical-
virtual applications are
created! Large numbers of connected smart things
7. Challenges
• Heterogeneity of devices Isolated island among the
and communication wireless sensor networks
protocols
Internet/
Web
WSN
WSN
8. Problem Statement
How to create open infrastructure to
handle devices embedded into the
physical world and access devices to
mash-up physical-virtual application
9. Our Works
RestThing infrastructure
REST-style architecture to ease the integration of
embedded sensor devices and existing applications
Mash-up physical resources and web 2.0 service to
create new type physical-virtual application
Evaluate the efficiency of the prototyping system
10. OUTLINE
• Introduction
• Related Works
• RestThing Architecture
• The Prototyping Implementation
• Evaluation
• Conclusion and Future Works
2011-11-12
11. Enabling Technologies
Some previous work used Big Web Services as the way to
access physical things
For example,
SenseWeb 1 by Kansal et al …
• used WS-API to provide
accessible interface
12. Enabling Technologies
Some previous work used Big Web Services as the way to
access physical things
Big Web Services as the extension of API-oriented SOAP/WSDL
• originally designed for integrate middleware and distributed systems
• mapping their APIs to the Web information system
However, along with the increasing functionality of theses systems, the
number standards and specifications of Big Web Services would become
more complicated and larger.
13. Related Works
Our work differs from these previous work by using REST
principles to provide the interface to physical things
" REST " was coined by Roy Fielding in his Ph.D. dissertation [2]
to describe a design pattern for implementing networked
systems.
14. Related Works
Our work differs from these previous work by using REST
principles to provide the interface to physical things
Erik Wilde3 work
• firstly pointed out reusing well-accepted
• Suggesting Web principles to interconnect the embedded
devices to the Web.
TinyRest4 bridged the Web with the physical world through a
restful gateway.
• However, it violated REST principles by introducing the extra
verbs ‘subscribe’.
15. OUTLINE
• Introduction
• Related Works
• RestThing Architecture
• The Prototyping Implementation
• Evaluation
• Conclusion and Future Works
2011-11-12
16. RestThing Infrastructure
• RestThing Infrastructure
– RestThing’s goal: various applications can coexist and access to
embedded devices available just like web information resources.
– REST-driven and Resource-Oriented Architecture (ROA).
• Why is RESTful
– Loose-coupling
– Uniform Operation
– Popularity
17. Design Issues
• Designing key
components:
– Restful APIs
– Adaptation layer
– Resources
– The services provider
– Applications
• Design detail issues:
– Applications access Physical things as like Web resources
– Accessing Physical things should inherit all the outstanding
mechanisms
18. Key Components: Restful API
• Restful API does prescribe the use of standards:
– HTTP
– URL
– XML/HTML/GIF/JPEG/etc. (Resource Representations)
– text/xml, text/html, image/gif, image/jpeg, etc.
URI: Http:// Embedded
Applications Or Web
Resources
Resources requirements
Many kinds forms
...
doc1.html
19. Key Components: Resource and Adaptation
• Heterogeneity
– Various types of embedded devices
– Dedicated communication protocols
• Device with TCP/IP • Device with TCP/IP
Sensor, IEEE802.15.4 Sensor platforms based on Sun
Small Programmable Object
• Adaptation
Technology (SPOT), connect
data transmission from the Web Internet via IEEE 802.15.4 link.
to the physical environment and
vice-versa. • Adaptation
To hide these operations Acting as the role of the driver
complexity and heterogeneity module bridging the gap between
the device and the Web
20. Key components: Service Provider and Apps
• The service provider is the central point of access in the
RestThing infrastructure for sharing accessible embedded
devices and creating applications.
• Two functions:
– The database to collect resource data
– Integration and combination for Restful APIs of embedded devices
and Web Resources
• Data collection • Restful APIs combination
Data from embedded devices Generating more functional and
Data from the existing Web site complicated services than just
adopting embedded devices or
Web resources
21. OUTLINE
• Introduction
• Related Works
• RestThing Architecture
• The Prototyping Implementation
• Evaluation
• Conclusion and Future Works
2011-11-12
22. Prototyping Implementation
• Implementation details:
– Wireless sensor network as
the representative of the
embedded devices
– REST-style gateway as the
adaptation support Ethernet
interface and Zigbee
communication
– Restful services deployed in
the personal computer
– Physical-virtual applications
with combining physical and
web resources runs on
Android-based smart phone
23. Wireless Sensor Network & Restful Gateway
• Wireless sensors are equipped with a
250kbps, 2.4GHz, IEEE802.15.4-compliant
Chip CC2420 Radio.
– Easy to program and offer some basic sensing
capabilities, e.g.
temperature, humidity, light, infrared, image
• Restful gateway acts as the adaptation
bridging the wireless sensor network and
Internet
– ARM9 32-bit RISC processor architecture, S3C2440
400MHz CPU processor and 64M Flash memory
– Provide a uniform interface to all components above
it and manages all sensors in its scope
– Obtain sensor data streams, submit data collection
demands, or access sensor characteristics through
the Restful API
24. Wireless Sensor Network & Restful Gateway
• Wireless sensors are equipped with a
250kbps, 2.4GHz, IEEE802.15.4-compliant
Chip CC2420 Radio.
– Easy to program and offer some basic sensing
capabilities, e.g. temperature, humidity, light,
infrared, image
• Restful gateway acts as the adaptation
bridging the wireless sensor network and
Internet
– The restful gateway implements the restful API using
http protocol
– sensors and the web information are view as
resources and manipulated by the uniform Restful
APIs in the HTTP standard
Resource REST MIME Type URI(the fixed prefix: http://localhost:port/wsn/)
Name Verb
SenCurrentRes GET XML/JSON sensors/{sensorid}/{dataType}.{mediaType}
SenHistoryRes GET XML/JSON sensors/history/{sensorid}/{dataType}/{fromTime}/
{toTime}.{mediaType}
SenActiveRes GET XML/JSON sensors/activeNode/all.{mediaType}
SenCmdRes POST XML/JSON sensors/{sensorid}/command/{dataType}.{mediaTy
pe}
25. Implementation
• Application demonstration using services which are provided by the
restful gateway.
– mobile phone (HTC Desire G7) based on android 2.2 operation system.
– RESTlet on Android with both the client-side and the server-side HTTP connectors
Real-time Data History Data (daily, Device Physical-virtual
(temperature, weekly, any Management (id, Mash-up
humidity, light, …) duration) operating system, (Temperature +
memory) SINA weibo API)
26. Implementation: physical-virtual mash-up
• Mash-up services
combining physical
resources and web
services
– Light Data
• sensors/{sensorid}/ligh
t.{mediaType}
– SINA Weibo API (like twitter)
• statuses/repost
• statuses/destroy
• statuses/update
• statuses/upload
27. OUTLINE
• Introduction
• Related Works
• RestThing Architecture
• The Prototyping Implementation
• Evaluation
• Conclusion and Future Works
2011-11-12
28. Evaluation
Evaluation from testing the amount of delay time from a request to
the back response
There are four test experiments:
• temperature real-time date with XML presentation
• temperature real-time date with JSON presentation
• temperature history date with XML presentation
• temperature history date with JSON presentation
29. Evaluation
The delay time consumed T are divided into three stages:
• Time 1(T1): reading from the serial-over-USB port and transformation data
from Zigbee format to Ethernet format
• Time 2(T2): storage in database
• Time 3(T3): Data encapsulation to the RESTlet URI’s presentation
T=T1+T2+T3
Gateway without REST via
GPRS communication:
• Just contains read date from serial
port and data transformation.
30. OUTLINE
• Introduction
• Related Works
• RestThing Architecture
• The Prototyping Implementation
• Evaluation
• Conclusion and Future Works
2011-11-12
31. Conclusion and Future Works
RestThing infrastructure based on the REST paradigm
Hide the heterogeneity of connected embedded devices
Provide an easy and seamless way for integrating embedded
devices with existing applications
Integrate wireless sensor networks, restful gateway and mash-up
application running on the smart phone
Tradeoff features/performance
32. Conclusion and Future Works
RestThing infrastructure based on the REST paradigm
Hide the heterogeneity of connected embedded devices
Provide an easy and seamless way for integrating embedded
devices with existing applications
Integrate wireless sensor networks, restful gateway and mash-up
application running on the smart phone
Tradeoff features/performance
Service composition
The third service interface for web services
Semantics
REST supported on embedded devices based on CoAP/6LoWPAN
600 Million hosts, and 1.4 Billion users currently in Internet Statistics. Google just passed 1 Trillion unique URLs. There are 100+ Billion microcontrollers worldwide with 10 Billion shipments a year. Those all have the potential to be networked. They will make up the Internet of Things which has the potential for a size in Trillions.
600 Million hosts, and 1.4 Billion users currently in Internet Statistics. Google just passed 1 Trillion unique URLs. There are 100+ Billion microcontrollers worldwide with 10 Billion shipments a year. Those all have the potential to be networked. They will make up the Internet of Things which has the potential for a size in Trillions.
Obviously, the application developers cannot grasp these technologies quickly. What they need is just low-enter barrier to quickly react to information or market requirements. Big Web Services cannot satisfy these requirements.these standards used the Web as a transport infrastructure and acted as.
Obviously, the application developers cannot grasp these technologies quickly. What they need is just low-enter barrier to quickly react to information or market requirements. Big Web Services cannot satisfy these requirements.these standards used the Web as a transport infrastructure and acted as.
Our work used the smart gateway to connect the physical devices to the Web information by REST principles
Our work used the smart gateway to connect the physical devices to the Web information by REST principles
Loosely couplingEase of integrating isolated information systemsScalability Uniform operationThe embedded devices are viewed resources' formatUniform operation on resources Popularity The successful case of the World Wide WebThe web 2.0 technologies
REST is just a design patternYou can't bottle up a pattern. You can only understand it and design your Web services to it.
REST is just a design patternYou can't bottle up a pattern. You can only understand it and design your Web services to it.
REST is just a design patternYou can't bottle up a pattern. You can only understand it and design your Web services to it.
Since the temperature history back response has more than 1000 items of data compared with the current data back response, it has longer delay time in the experiment. When the amount of data is small (real-time data response is small amount), JSON and XML presentations have more or less time delay. If the data amount is large, using JSON as resource presentation has less time delay than XML.