You are on page 1of 8

Embedded Web Services http://dev.emcelettronica.

com/print/51816

Your Electronics Open Source


(http://dev.emcelettronica.com)
Home > Blog > allankliu's blog > Content

Embedded Web Services


By allankliu
Created 25/06/2008 - 10:27

BLOG Ethernet Gps Microcontrollers

Introduction

The embedded internet is very common in latest electronics devices. The


embedded web server used to be a hot topic since this technology can leverage
common information technology infrastructure, including modem, Ethernet, PPP
dial-up and web browser; there is no need to install any software on client
computers. A lot of consumer electronics have already installed with embedded
web servers, from router, switch, internet radio to NAS and IPTV. In the industrial
field device market, ARC predicts that over the next five years, IP/Ethernet will
dominate all field connections except for the final connection to the lowest level
sensors and actuators. Besides to tftp and telnet, embedded web server is the
most common technology used in both consumer and industrial electronics
devices, especially for the classic "head-less" embedded systems, which has
limited or no display at all.

This topic catches my attention again because I am building a cross-platform


Web GIS site with Google map API. This mash-up site is inspired from the Dash
GPS pilot running in US. The project allows exchanging the geographic information between web user, mobile phone user and GPS navigator
user. The information of POI, driving direction, traffic jam and geo-tagged advertisement will be collected and pushed to the audience in the
target locations. The new AJAX/JSON technologies used in Google Map, Yahoo Map and Virtual earth bring more attractive features and
experiences for end users. The GPS devices have powerful processor for parsing web service from web servers. So I review this topic to check
if this new wave of web can bring extra innovation to embedded systems.

The topic is too big so I'll talk just about of a small part of it, which is designed in the deep embedded systems in RTOS/Linux.

About Embedded Web Services (EWS)

According to the classic definition, web services are application components, which use open protocols, are platform independent, self-contained
and self explained. These services can be detected by UDDI and used by other application components. All of these services are encoded in
XML, a general purpose data exchange format for both machines and humans. A complete web services should include SOAP, WSDL and
UDDI.

SOAP is an acronym for ‘Simple Object Access Protocol’ and is a XML based specification for message based communication and for remote
procedure call (RPC) communication. Furthermore SOAP allows the server to respond to the client not only a short status message but also
every kind of data, which could be serialized following the same rules as above.

Once you have implemented a SOAP server, the only issue is to make its services (that are the available function calls) public to all possible
clients. For this purpose the Web Service Description Language (WSDL) was introduced by the W3 Consortium. This language has exactly the
above needed purpose: The standardized description of services, a site offers to clients via the internet.

UDDI is a directory service, described by WDSL and It stands for Universal Description, Discovery and Integration. This layer will publish the
web services and allows other application to discovery the services, then access the WSDL file on the registered URI to access the SOAP
services.

If the designer implements embedded SOAP toolkit on existing web server, the system requires more resources in storage, communication
bandwidth. It is a big challenge to integrate full featured embedded web services. There are many embedded web services solutions suitable for
powerful microcontroller; we still have to fine tune the design to fit the system into a low-end micro ( sometimes we have to sacrifice the
compliance to the standards).

Here is a table summaries for proprietary protocol, embedded web server and embedded web service used in embedded systems.

Obviously the legacy proprietary protocol


Proprietary protocol embedded web server embedded web services
will not take resources as much as web
Interoperability - + + server does. But concerning the reuse of
software, interoperability and system
User Interface - custom design + web browser O local UI toolkit or browser integration, the standard solutions should
be cost effective and successful. The
Resources + O - embedded web service is a step further,
which offers more flexibility, easier system
Reuse of Components - O +
integration, manufacturer independent

1 din 8 26.06.2008 10:11


Embedded Web Services http://dev.emcelettronica.com/print/51816

services. Additionally, XML based web service interfaces can also fulfill the requirements of all aspects from maintenance records,
documentation, configuration to alarm handling.

XML Parsing

The XML generation is relatively easier; it is just a print routine like HTML generation. XML parsing asks larger memory size, which is limited in a
resource restricted embedded system. Additionally, XML parsers are offered in C++, Java, Perl, Python and JavaScript available in PC and high
end embedded platforms. For instance, C++, Java, Python are available on Symbian smart phone; C#, Java are available on Windows Mobile
platform; most of the languages are available on embedded Linux. But most of the low-end microcontrollers including 80C51, PIC, AVR only
support C. Even if we use advanced microprocessor like ARM7, we should also consider memory allocation for C++ XML parser. LibXML and
expat are the XML parsers in C. According to a report for expat, the memory usage of expat is above 300KB, depending on the nesting of XML
file. Allegrosoft's ROMXML is more suitable for low-end microcontroller, it uses tag matching to reduce memory footprint. But it is a commercial
solution. I listed some open source XML parsers in the references. In a classic web service design, XML is deployed in every protocol. However
sometimes we can avoid using XML format. I will cover the optimization of EWS later.

EWS Server and Client

EWS applications are used in either server and client roles, or mix roles in one system. Because XML only delivers data over HTTP/IP
connection, the UI presentation can be constructed locally. It is called Rich Client Application. The legacy server side computing massive
architecture is called thin client. In general, the client should has some components to display the XML content to users. Emcelettronica offers
an open source FTPmicro project [1] for displaying news RSS feed on a LCD display. This project has integrated Ethernet connection, FAT file
system on a SD card, and a PIC18 microcontroller. RSS is not only a news feed, but also a generic XML container. A lot of web services such as
weather forecasting, geographic services, and even search engines can support dynamic RSS query over HTTP. The reference design is a
good starting point for launch a RSS EWS application, like outdoor billboard and on board navigator.

On the other hand, EWS server is also very common. I know of a rewarded project of a design
challenge, which used mobile phone for remote heart monitoring. A cardiopathic patient keeps on
hiking and climbing . His doctor and his son designed a device attached to a mobile phone to monitor
his heart rate, track the geographic location from GPS, encode in the form of RSS feed, and then
upload to a web server regularly. With this approach, his doctor and his family can monitor his health
and know his location. If there is an emergency, they can call help and locate him as soon as
possible. Because the information is encoded in XML format, they can see the result in both web
browser and mobile phones. It is not a real web server service application, for this device just uses
HTTP-POST to upload XML file. Obviously it can be upgraded to a EWS application if the connection
can be kept permanent. So far, I have not found any projects to use mobile phone as web server with
dial up connection. If the EWS server can be connected to a POTS/ISDN modem or Ethernet, the
EWS server can be connected over dial up or IP network. The regular hospital patient surveillance
system could get benefit from this design. Similar applications also include security surveillance,
home automation, and remote access. The remote clients can access the EWS server via mobile
phone, web browser or local integrated application environment.

Are SOAP, WSDL and UDDI necessary for an EWS?

As I mentioned above, SOAP, WSDL and UDDI are classic concepts for web services. Meanwhile
more and more alternative web services technologies are taking positions on the market. REST and
JSON are promising ones. Even the XML-RPC is still widely used in web development. These
lightweight protocols are more suitable for embedded systems. XML-RPC is an early stage web
service of SOAP. XML-RPC can use simpler HTTP-POST or HTTP-GET URL in plain text. It is used
in the simple applications, just like fetching a RSS feed.

For example, the URL of http://news.search.yahoo.com/news/rss;..... [2] will fetch a news feed for searching keyword of Earthquake. The return
result is an XML message. You can pull the news and display on billboard. We don't use any SOAP stuff. So at least we can use plain text in
HTTP query. It is very useful in IPTV. Today more and more IPTVs can download digital media via servers or P2P connection; it can use this
method to pull and download the close caption for a DVD.

Google and other sites even discard the SOAP interface and XML-RPC, they use JSON (JSON stands for JavaScript Object Notation) to offer
plain text result from server. It is a human readable data exchange format for simple data structures and arrays. You can visit
http://code.google.com/apis/maps/documentation/services.html [3] to check a JSON style Google map services. It seems like a fraction of source
code and this return code can be used directly in JavaScript. JSON is dedicated for JavaScript purposes, but it could also be beneficial to the
embedded system in a simpler data parser in C, since most of the punctuation symbols are very simple to search and locate. I have not source
code or library for JSON parser. But I believe any programmer can roll out own solution.

A benefit of XML is the separation between data structure and content presentation. The presentation could be CSS or XSLT. It is also suitable
for embedded server, since we can put the CSS in a separate URL, rather than in the embedded server. For example, we can put the CSS and
JavaScript in the local host (127.0.0.1) when we connect to an embedded server. By this means, only the core essential data is transmitted thus
minimizing system requirement. This approach is also very much effective than old approach.

If the embedded web services must be SOAP/WSDL/UDDI compliant, then we have to pick a powerful microprocessor to deploy these protocols.
This approach might be flexible in a hybrid environment by devices from different manufacturers.

Popular Web Services

If you visit www.programmableweb.com [4], you can find 752 web APIs for web services. [Not all
these APIs are available for embedded system], but most of these APIs can work in
high-ended embedded systems like iPod. iPod has a 500MHz microprocessor and a full

2 din 8 26.06.2008 10:11


Embedded Web Services http://dev.emcelettronica.com/print/51816

featured Safari browser with JavaScript support. The JavaScript is not a non-essential
technology to display the stupid visual effect of a web page any more, the modern AJAX
applications are heavily using JavaScript to present faster, fully interactive web applications
with same experience of application software running locally. iPod can support Google map
and YouTube with these features. But the most of embedded systems are resource restricted
devices without JavaScript engine, local file system and other essential components. Basically
these embedded systems can only use the XML based web service interfaces.

Here is my list found for embedded system.

RSS/Atom are popular for news feed and general purpose.


GeoRSS/KML/GPX are used in Web GIS, GPS geographic information exchange.
Flickr offers popular online photo sharing, which can be connected to DC or mobile phones.
411Sync offers SMS communication used in many applications.

Geocoder, which is used in geocoding in Web GIS, but also useful in GPS devices.

YouTube offers video sharing, but only for high-end embedded systems.
Lat49 offers Geo-targeted advertising for online maps.
Instant messenger, which will be very popular in future embedded systems, since IM can support robot to automatically process some
remote commands.
File Sharing, which can be used for general purpose file transfer service between devices.
Financial web services are commercial services, offer real-time quotation over mobile phones.
Payment web services will be hotter in next generation applications.
Security, which is required in many environments.

At last, try to get breakthrough of your imagination and create something new.

Refereneces

API Dashboard from ProgrammableWeb.com

[5]

XML from w3.org

[6]

SOAP from w3.org

[7]

3 din 8 26.06.2008 10:11


Embedded Web Services http://dev.emcelettronica.com/print/51816

WSDL from w3.org

[8]

An XML Web Services Development Environment for Embedded Devices, by Florida State Univeristy

[9]

Safari Books Online - Building Web Services with Java: Making Sense of XML, SOAP, WSDL and UDDI

[10]

EMCelettronica offers open source design ftpmicro kit, you can read the RSS news on attached LCD screen. Try
it yourself!

[11]

Introduction to Web Services

[12]

Embedded Services from Microsoft Research

[13]

4 din 8 26.06.2008 10:11


Embedded Web Services http://dev.emcelettronica.com/print/51816

Embedded Web Services: Making Sense out of Diverse Sensors

[14]

Industrial TCP/IP services monitoring through embedded web services

[15]

A new embedded Web services approach to wireless sensor networks

[16]

Web Services on Embedded Devices

[17]

Embedded Web Services

[18]

Web Services User Interface (WSUI) Initiative

[19]

Yahoo aims web services at mobile phones

[20]

5 din 8 26.06.2008 10:11


Embedded Web Services http://dev.emcelettronica.com/print/51816

libXML in Gnome project.

[21]

expat project page

[22]

Using expat

[23]

The ROMXML from Allegrosoft is a XML parser for embedded system. The primary need for an embedded XML
Parser or Framer is to efficiently translate data between XML syntax and internal storage (typically a C structure).
The Allegro RomXML Parsing and Framing toolkit provides a lightweight translation between pre-defined
C-language structures and XML-based representations.

[24]

NanoXML project for Java, just need 6KB memory to parse an XML file.

[25]

TinyXML parser project.

[26]

6 din 8 26.06.2008 10:11


Embedded Web Services http://dev.emcelettronica.com/print/51816

Building Web Services the REST Way

[27]

JSON definition from Wikipedia, JSON (pronounced as "Jason"), short for JavaScript Object Notation, is a
lightweight computer data interchange format. It is a text-based, human-readable format for representing simple
data structures and associative arrays (called objects).

[28]

XML RPC tutorial

[29]

Using the XML HTTP Request object

[30]

Trademarks

Source URL: http://dev.emcelettronica.com/embedded-web-services

Links:
[1] http://dev.emcelettronica.com/ftpmicro
[2]
http://news.search.yahoo.com/news/rss;_ylt=A9j8eu6ppzZIq20B.wjQtDMD;_ylu=X3oDMTA3MTBsZGZsBHNlYwNhZG0-?ei=UTF-8&p=Earthquake&c=&eo=UTF-8
[3] http://code.google.com/apis/maps/documentation/services.html
[4] http://www.programmableweb.com
[5] http://www.programmableweb.com/apis
[6] http://www.w3.org/XML/
[7] http://www.w3.org/TR/soap12-part1/
[8] http://www.w3.org/TR/wsdl
[9] http://www.cs.fsu.edu/~engelen/cases03.html
[10] http://safari.oreilly.com/0672321815/ch09lev1sec6
[11] http://dev.emcelettronica.com/ftpmicro-dip-en
[12] http://www.embedded.com/story/OEG20020125S0103
[13] http://research.microsoft.com/research/EmbeddedSystems/EWS/
[14] http://www.sensorsmag.com/sensors/article/articleDetail.jsp?id=430624
[15] http://portal.acm.org/citation.cfm?id=1340444.1340446&coll=&dl=
[16] http://portal.acm.org/citation.cfm?id=1182807.1182847
[17] http://whitepapers.zdnet.co.uk/0,1000000651,260283353p,00.htm
[18] http://barracudaserver.com/
[19] http://xml.coverpages.org/wsui.html
[20] http://www.windowsfordevices.com/news/NS5064769796.html
[21] http://xmlsoft.org/
[22] http://expat.sourceforge.net/
[23] http://www.xml.com/pub/a/1999/09/expat/index.html
[24] http://www.allegrosoft.com/romxml.html
[25] http://nanoxml.sourceforge.net/orig/
[26] http://sourceforge.net/projects/tinyxml

7 din 8 26.06.2008 10:11


Embedded Web Services http://dev.emcelettronica.com/print/51816

[27] http://www.xfront.com/REST-Web-Services.html
[28] http://en.wikipedia.org/wiki/JSON
[29] http://www.xmlrpc.com/directory/1568/tutorialspress
[30] http://www.jibbering.com/2002/4/httprequest.html

8 din 8 26.06.2008 10:11

You might also like