Web services as a middle tier
Can Web services be used as middle tier? How can we do it? How are the transactions carried on?
Web services can most certainly be used as a middle tier for many kinds of problems. As for transactions, there are many different levels that you can consider. The easiest approach to implement, given today's standards, is to make sure that each request is a complete transaction -- this will give you reliability similar to existing client/server systems (from the client to the server tier). If you need the ability to have multiple independent requests encapsulated within a single 2PC (two-phase commit) transaction, unfortunately, the standards just aren't there yet (though there are a number of proposals on the table, such as WS-AtomicTransaction). The challenge with 2PC, however, is that it only works in a synchronous environment, which limits overall availability (a chain is only as good as its weakest link). You might want to consider how you would recast portions of your architecture to be asynchronous
where appropriate, to decouple the different tiers as much as possible. As part of this, think about using compensating transactions to revert changes, as opposed to using 2PC. While asynchrony is not appropriate for every portion of an overall architecture, if you use it wisely the end result will be a more robust and flexible architecture in general.
This was first published in December 2003