XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] Designing an experiment to gather evidence onapproaches to designing web services

Hi Rich,

> I do not understand the difference [between the two approaches that were listed], can you explain?

Perhaps an example would help.

Consider designing a web service to convert currencies.

Suppose we want the web service to convert 100 USD to the equivalent Sterling Pounds (GBP).

Here is an example of inbound data:

<Money>
      <date>2011-12-28</date>
      <from>
             <currency>USD</currency>
            <value>100.00</value>
      </from>
      <to>
             <currency>GBP</currency>
      </to>
</Money>

Here is the outbound data: 

<Money>
      <date>2011-12-28</date>
      <from>
             <currency>USD</currency>
            <value>100.00</value>
      </from>
      <to>
             <currency>GBP</currency>
            <value>63.81</value>
      </to>
</Money>

With the first approach (a) the web service is designed like so:

An XProc document is created that expresses this workflow:

    - Validate the inbound XML document against Money.xsd

   - If invalid then 
            - submit the inbound document to XSLT to transform it into a log XML document and
              store the log XML document in the logs native XML database and reply to the sender
              with the log XML document

    - If valid then submit the inbound document to another XSLT to convert the currency and produce a
      result XML document and reply to the sender with the result XML document
       
With the second approach (b) the web service is designed like so:

A Java servlet is created that contains code that expresses this algorithm:

     - using the DOM API retrieve the inbound document's date value and store it in a variable D of type date,
        retrieve the from/currency value and store it in a variable C of type nonNegativeInt, and so on.

    - write some exception handling code to be triggered it the retrieved values do not match
       the variable's data type.

     - Write some code to do the currency conversion.

    - using the DOM API construct an XML document. Store the values of the variables into
      the DOM tree, along with the new value.

     - send the result XML

Notice the differences:

(a) The workflow is expressed in and XML document (using XProc)

Versus

(b) The workflow is expressed using a sequence of imperative code statements

------------------

(a)  Validation rules are declaratively expressed in an XML Schema and validation is done using a XML Schema validator

Versus

(b) Validation is implicitly accomplished via triggering exception handling code

------------------

(a) The outbound XML document is merely a transformation of the inbound XML document . This XML transformation is accomplished using an XSLT document and an XSLT processor

Versus

(b) The currency conversion is a matter of creating an algorithm and then implementing the algorithm through a sequence of imperative code statements.

------------------

And so forth.

Rich, does that highlight some of the differences between the two approach that I listed? 

/Roger



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS