Accessing Devices Using a Web Service
(Page 1 of 5 )

The old days when embedded devices and factory floor machines had only minimal interaction with humans, the on/off button and little else, are gone. Today the ability to access the device from anywhere is expected. This is a significant challenge when we are sweating over every dollar required in hardware. With a little bit of knowledge and a relatively small piece of software, we can provide a Web service for this type of interaction.
Introduction
The old days when embedded devices and factory floor machines had only minimal interaction with humans, the on/off button and little else, are gone. Today the ability to access the device from anywhere is expected. This is a significant challenge when we are sweating over every dollar required in hardware.
There are at least four questions we need to address to examine the issue of remote access:
- Who needs access? The manufacturer of the machine, the user of the machine or both, other?
- What will they do? Gather status/historical information, perform maintenance, updating or troubleshooting.
- How will access be provided? Proprietary protocols, open protocols or a mixed set.
- When will access be allowed? User controlled physical access, open access with appropriate security measures or something else.
In general the answers to these questions are:
- Both manufacturer and the user will need access.
- The user will access the machine primarily to gather status/historical information (i.e. listeners).
- The manufacture will use their access for all the stated reasons (i.e. controllers).
- We will use the most ubiquitous and cost effective transport possible, TCP/IP on top of Ethernet (probably of the 10BaseT variety).
I strongly favor a two-channel architecture. This is:
- Use a TCP/IP socket interface with an unknown TCP port and a proprietary application message protocol to provide control. This is both the most secure and the best performance solution possible. In addition it is a small footprint/low overhead approach that can be supported even on a slim platform.
- Use open technology (HTTP and XML) to address data gathering/surveillance requirements. This is a “read only” channel thereby eliminating most security and performance issues. (In the parlance of the time this is a bare bones web service.)
A typical factory floor machine controller might look like:

The second channel is what will be explored in more depth in this paper. The normal means of achieving this capability is by using a full function Web Server with extensions to provide an interactive exchange between the client and the server, e.g. Microsoft’s IIS with ASP, or Macromedia’s ColdFusion with JSP etc. This is a complicated solution that can prove to be costly and difficult to administer and secure. For an embedded application it is like driving a finishing nail with a ten-pound sledgehammer. Luckily there is a straightforward solution that does not require the sledgehammer. Even a rather cursory knowledge of HTTP and XML enables a software engineer to develop a secure application specific solution with the smallest possible resource demands. The basic facts are:
- The transport for HTTP is a TCP/IP socket that uses TCP port 80 on the server.
- HTTP is a simple text based protocol, most of which we can ignore.
- XML is a text based mark-up language that is easy to understand and create. It does not have to be any more complicated then we want it to be.
We need a TCP/IP stack, a socket interface to the stack and a relatively small piece of software, the Web Service Interface, and we are there. We will travel down the road of developing this interface one step at a time:
- Understanding HTTP requests.
- Understanding HTTP responses.
- Understanding an XML document.
- Defining requests and responses.
- Implementing a simple Web service.
Next: HTTP Requests and Responses >>
More Web Services Articles
More By Terry Ess