SOAP & Web Services An Embeddable Standards Compliant Web Service Server |
Introduction The belief that by the year 200x there will be more smart devices on the Internet than people has become widely accepted. There are a number of TCP/IP high level protocols that have good potential for connecting smart devices, depending on the application and platform. One of the most general (and complex) is the evolving series of transport and content protocols that are bundled under the banner of web service. At its essence this is nothing more than an interface that transports XML documents using the HTTP protocol. At this basic level a fairly general purpose server for information retrieval can be implemented in less than 500 lines of C (this represents approximately 3 KB of ROM in a M68HC12 micro-controller; download www.the-solution-llc.com/webservice.zip for all the technical details). Use of the service can be easily incorporated into a web page (or other media) with just a small amount of scripting (VB or Java). However, if we want our device to tie to the IT infrastructure or we want capabilities beyond just information retrieval, then we need to go further. In the IT world we could use Web Servers extended with .NET or J2EE “middleware”. For many smart devices, this is not an acceptable answer. Not only are these components large, they are also maintenance intense. So what would it take to make a fairly general purpose server that would meet our expanded requirements and still be embeddable? This article will explore exactly that. Requirements The design of the reference implementations was driven by five primary requirements:
First, the design is driven by some load characteristic assumptions:
We want our interface to provide a very general purpose capability so that it will meet all our information retrieval, configuration and control needs. The most general means of communications is to combine a command with a response, a conversation. A message is the basic unit of communication to command an action or respond to a command. At the minimum it is composed of a function code. Typical functions supported are:
Additional message fields are required based on the nature of the message’s function. A summary of a typical command and response message set is provided in the following table:
For the reference application we will limit ourselves to two actions, locking the device (i.e. preventing the modification of parameters or the execution of actions by anyone else) and “operating” and four parameters, all short (two bytes). We need to meet “web service standards” at the interface (not necessarily internally). This is a moving target, but there is a good practical starting point, the standards required by both the .NET and Java based tools that automate the construction of web service client stubs (this is pretty much the WS-I Basic Profile 1.0 without UDDI):
Since we control the definition of the web service, we will make some definition decisions that help to simplify our life (and appear to be the direction of the future gauging by the drafts of SOAP 1.2):
The reference implementation’s dependency on platform provided resources was kept to:
Finally, a “basic” level of security is assumed to be required. The scheme used in the reference implementation is based on the concept of a one time pad and is suitable for even “deeply” embedded applications. The specific parameters used for the reference implementations follow:
blog comments powered by Disqus |