[
Lists Home |
Date Index |
Thread Index
]
Subject: Approaches to designing XML messages
I have convinced myself that there are two fundamentally different
approaches to designing Web service XML messages. They are:
1. The data-oriented approach
2. The action-oriented approach
I believe that which approach a person takes will have serious
implications on the nature of Web services.
Below I elaborate upon each approach. Before doing so, however, I
present the 3 questions that I have:
a. Has someone already articulated the two approaches?
b. What are the pros/cons of the two approaches, especially as applied
to Web services?
c. Intuitively, I think that the data-oriented approach is the right
approach. I believe that XML messages should not be simply procedure
calls disguished in XML (which is how I see the action-oriented
approach). Data-oriented XML messages requires a different mindset, and
will result in a different way of building Web services. However, I do
not have clarity on how to create services that are data-oriented.
After all, isn't the purpose of a service is to "do some action"? Can
you provide clarity?
1. The data-oriented XML message approach
With this approach a message is simply comprised of data. The tags
denote data, not actions. For example, below is an XML message that is
to be sent to a travel agent service:
<itinerary>
<departureInfo>
<departingCity>Boston</departingCity>
<destination>Washington, D.C.</destination>
<departureDate>2002-2-4</departureDate>
<departureTime>late afternoon</departureTime>
<seatPreference>aisle</seatPreference>
</departureInfo>
<returnInfo>
<departingCity>Washington, D.C.</departingCity>
<destination>Boston</destination>
<departureDate>2002-2-10</departureDate>
<departureTime>mid morning</departureTime>
<seatPreference/>
</returnInfo>
</itinerary>
Notice that this XML message just contains data about a person's
itinerary. Since this is simply data, not targeted to any particular
application, I can imagine that it could be used by a variety of Web
services, not just a travel agent service.
2. The action-oriented XML message approach
With this approach a message is basically a procedure call disguised in
XML:
<getFlights>
<departureInfo>
<departingCity>Boston</departingCity>
<destination>Washington, D.C.</destination>
<departureDate>2002-2-4</departureDate>
<departureTime>late afternoon</departureTime>
<seatPreference>aisle</seatPreference>
</departureInfo>
<returnInfo>
<departingCity>Washington, D.C.</departingCity>
<destination>Boston</destination>
<departureDate>2002-2-10</departureDate>
<departureTime>mid morning</departureTime>
<seatPreference/>
</returnInfo>
</getFlights>
This XML message is identical to the earlier XML message except for the
root element. The root element implies action. The root element is
directly correlated to a method name. Its child elements are the
parameters.
I contend that this action-oriented root element gives the message a
very different feel. I contend that it tightly couples the message to a
particular kind of service - one that returns flight information. The
data-oriented approach, on the other hand, is not coupled to any
service, so it could be used by a variety of services.
I appreciate any clarity you can bring to this topic. /Roger
|