Home arrow Web Services arrow Page 3 - Accessing Devices Using a Web Service
WEB SERVICES

Accessing Devices Using a Web Service


Web ServicesThe 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.

Author Info:
By: Terry Ess
Rating: 4 stars4 stars4 stars4 stars4 stars / 19
January 14, 2004
TABLE OF CONTENTS:
  1. · Accessing Devices Using a Web Service
  2. · HTTP Requests and Responses
  3. · XML
  4. · Web Service Implementation
  5. · Conclusion

print this article
SEARCH DEVARTICLES

Accessing Devices Using a Web Service - XML
(Page 3 of 5 )

The Extensible Markup Language provides a standardized means of describing and transferring data. XML is a meta-markup language, a set of rules for creating semantic tags used to describe data. An XML element is made up of a start tag, an end tag, and data in between. The start and end tags describe the data within the tags, which is considered the value of the element. For example, the following XML element is a <director> element with the value "Matthew Dunn."

<director>Matthew Dunn</director>

The element name "director" allows you to mark up the value "Matthew Dunn" semantically, so you can differentiate that particular bit of data from another, similar bit of data. For example, there might be another element with the value "Matthew Dunn."

<actor>Matthew Dunn</actor>

Because each element has a different tag name, you can easily tell that one element refers to Matthew Dunn, the director, while the other refers to Matthew Dunn, the actor. If there were no way to mark up the data semantically, having two elements with the same value might cause confusion.

In addition, XML tags are case-sensitive, so the following are each a different element.

<City> <CITY> <city>

An element can optionally contain one or more attributes. An attribute is a name-value pair separated by an equal sign (=).

<CITY ZIP="01085">Westfield</CITY>

In this example, ZIP="01085" is an attribute of the <CITY> element. Attributes are used to attach additional, secondary information to an element, usually meta information. Attributes can also accept default values, while elements cannot. Each attribute of an element can be specified only once, but in any order.

A basic XML document is simply an XML element that can, but might not, include nested XML elements.  For example, the XML <books> element is a valid XML document:


<books>
<book isbn="0345374827">
<title>The Great Shark Hunt</title>
<author>Hunter SThompson</author>
</book>
</books>

There are some things to remember when constructing a basic XML document:

  1. All elements must have an end tag.

  2. All elements must be cleanly nested (overlapping elements are not allowed).

  3. All attribute values must be enclosed in quotation marks.

  4. Each document must have a unique first element, the root node

HTTP Request

Response

GET /VersionWeb service’s software version
GET /TimeWeb services’ current local time
GET /Listener.htmThe example listener Web page
All other requestsHTTP error response

Response

XML

Software version<SwVersion>
<Major>integer</Major>
<Minor>integer </Minor>
<Rev>integer </Rev>
</SwVersion>"
Time<StateTime>
<Hour>integer</Hour>
<Minute>integer</Minute>
<Second>integer</Second>
</StateTime>

*Integer – signed integer number

The HTTP requests are easily made in a Web Browser.  For instance to generate the version request would look like “http://hostname/Version”.  If request compatibility with a full scale Web server, e.g. Microsoft IIS using ASP, is important then the request could be changed to “GET /Get.Asp?WCI=Version".


blog comments powered by Disqus
WEB SERVICES ARTICLES

- Dealing with Loose Coupling in a Service-Ori...
- Loose Coupling in a Service-Oriented Archite...
- Safety, Idempotence, and the Resource-Orient...
- The Resource-Oriented Architecture in Action
- Features of the Resource-Oriented Architectu...
- The Resource-Oriented Architecture
- Getting Started with Flex
- Automated Billing and Faxing for the Web
- An Introduction to Web Services
- The Foundations of Web Services: From Novice...
- Web Services Reengineering: Finishing Touches
- Fault Handling with Web Services
- Flow and Web Services
- Process Lifecycles and Web Services
- Business Processes and Web Services

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials