Learning Center
Plans & pricing Sign in
Sign Out

Embedded Web Services


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.

More Info
									Embedded Web Services

Your Electronics Open Source
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. Proprietary protocol embedded web server embedded web services Interoperability User Interface Resources - custom design + + + web browser O O Obviously the legacy proprietary protocol will not take resources as much as web server does. But concerning the reuse of + software, interoperability and system O local UI toolkit or browser integration, the standard solutions should be cost effective and successful. The embedded web service is a step further, which offers more flexibility, easier system + integration, manufacturer independent

Reuse of Components -

1 din 8

26.06.2008 10:11

Embedded Web Services

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;..... [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 [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 ( 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 [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

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


XML from


SOAP from


3 din 8

26.06.2008 10:11

Embedded Web Services

WSDL from


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


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


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


Introduction to Web Services


Embedded Services from Microsoft Research


4 din 8

26.06.2008 10:11

Embedded Web Services

Embedded Web Services: Making Sense out of Diverse Sensors


Industrial TCP/IP services monitoring through embedded web services


A new embedded Web services approach to wireless sensor networks


Web Services on Embedded Devices


Embedded Web Services


Web Services User Interface (WSUI) Initiative


Yahoo aims web services at mobile phones


5 din 8

26.06.2008 10:11

Embedded Web Services

libXML in Gnome project.


expat project page


Using expat


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.


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


TinyXML parser project.


6 din 8

26.06.2008 10:11

Embedded Web Services

Building Web Services the REST Way


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).


XML RPC tutorial


Using the XML HTTP Request object



Source URL: Links: [1] [2];_ylt=A9j8eu6ppzZIq20B.wjQtDMD;_ylu=X3oDMTA3MTBsZGZsBHNlYwNhZG0-?ei=UTF-8&p=Earthquake&c=&eo=UTF-8 [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17],1000000651,260283353p,00.htm [18] [19] [20] [21] [22] [23] [24] [25] [26]

7 din 8

26.06.2008 10:11

Embedded Web Services

[27] [28] [29] [30]

8 din 8

26.06.2008 10:11

To top