OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Categories of Web Service messages: data-oriented vs actio

[ Lists Home | Date Index | Thread Index ]

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





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS