[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Categories of Web Service messages: data-oriented vs actio

  • To: xml-dev@l...
  • Subject: Re: Categories of Web Service messages: data-oriented vs action-oriented
  • From: "Roger L. Costello" <costello@m...>
  • Date: Thu, 07 Feb 2002 09:49:27 -0500
  • Cc: costello@m...
  • Organization: The MITRE Corporation

dyveke spino
I feel like we are close to exhausting the issue of the best way to
design an XML message.  Recall the 2 approaches we have discussed:

  - Approach 1: should I colocate an indication of the desired action  
    with the part of the message that the action applies to, or
  - Approach 2: should I separate the actions from the data?

I am hopeful that today we can come to an agreed-to best practice for
this issue.  At the very least, I would like to ensure that both
approaches are completely understood, as well as the tradeoffs.

Yesterday Mark Baker and Michael Brennen were tossing around an example
of an XML message to purchase a CD.  Michael asserted that such a
message would contain multiple actions: 

    - a "buy this item" action, 
    - a "use this credit card" action, and 
    - a "ship to this address" action.  

In previous discussions we have not looked at an example with multiple
actions.  Hopefully, such an example will provide insight into which
approach is better. So, I would like to use this CD-purchase example to
compare (once again) the 2 approaches. 

Here's the CD-purchase message where each action is colocated with the
XML subtree that it applies to.

<message>
    <body>
        <PurchaseOrder action="purchase-CD">
            <CD>
                <Title>Timeless Serenity</Title>
                <Author>Dyveke Spino</Author>
                <Date>1984</Date>
                <RecordingCompany>
                    Dyveke Spino Productions
                </RecordingCompany>
            </CD>
            <credit-card action="bill-credit-card">
                <type>Visa</type>
                <name>John Doe</name>
                <number>1234 5678 9012 3456</number>
                <exp-date>11-03</exp-date>
            </credit-card>
            <billing-address>
                <street>101 Smith Rd</street>
                <city>Boston</city>
                <state>MA</state>
                <zip>03100</zip>
            </billing-address>
            <delivery-address action="mail-item">
                <street>101 Smith Rd</street>
                <city>Boston</city>
                <state>MA</state>
                <zip>03100</zip>
            </delivery-address>
        </PurchaseOrder>
    </body>
</message>

Note the 3 actions that are specified:
   - purchase-CD
   - bill-credit-card
   - mail-item

The purchase-CD action is an attribute of the <PurchaseOrder> element. 
The bill-credit-card action is an attribute of the <credit-card>
element.  The mail-item action is an attribute of the <delivery-address>
element.

Questions:

1. I am having a really hard time understanding the later two actions. 
Of course I understand that a service would need to perform these two
actions, but I fail to understand why a "client" would have to
explicitly specify these actions in the XML message.  Such "sub-actions"
seem to be part of the semantics of the umbrella "purchase-CD" action. 
Can someone explain this to me?  Or, is it just a poor example of a
multi-action message?  If so, please give me a better example.

-------------------------------------------------------------------
Let's turn to the other approach - separate the action from the data. 
One of the purported disadvantages of this approach was that it may be
difficult/impossible to express actions of various parts of the
message's data.  However, yesterday Christian Nentwich proposed an
elegant solution - using XLink/XPointers to link an action to its data. 
(I like this idea!).  That's the approach I have taken below.

Here's the CD-purchase message where the actions are separate from the
data:

<message>
   <header>
      <action xlink:href="#message/body/PurchaseOrder/CD">
          purchase-CD
      </action>
      <action xlink:href="#message/body/PurchaseOrder/credit-card">
          bill-credit-card
      <action>
      <action xlink:href="#message/body/PurchaseOrder/delivery-address">
          mail-item
      <action>
   </header>
   <body>
       <PurchaseOrder>
            <CD>
                <Title>Timeless Serenity</Title>
                <Author>Dyveke Spino</Author>
                <Date>1984</Date>
                <RecordingCompany>
                    Dyveke Spino Productions
                </RecordingCompany>
            </CD>
            <credit-card>
                <type>Visa</type>
                <name>John Doe</name>
                <number>1234 5678 9012 3456</number>
                <exp-date>11-03</exp-date>
            </credit-card>
            <billing-address>
                <street>101 Smith Rd</street>
                <city>Boston</city>
                <state>MA</state>
                <zip>03100</zip>
            </billing-address>
            <delivery-address>
                <street>101 Smith Rd</street>
                <city>Boston</city>
                <state>MA</state>
                <zip>03100</zip>
            </delivery-address>
       </PurchaseOrder>
   </body>
</message>

Questions:

1. One of the arguments against this approach (separating the action
from the data) is that it didn't allow "rich messages where multiple
actions are specified".  However, as we see here, with the XLink
approach we can have the message richness.  Thus, doesn't this approach
have all the benefits of the other approach, without its disadvantages? 
Am I missing something?

-------------------------------------------------------------------
Summary

I have layed out an example showing both approaches in a multi-action
scenario.  Does this shed any new light on the which approach is
better?  What's best practice?  /Roger


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.