The XA standard defines a mechanism to coordinate transactions across multiple transaction managers, but I'm skeptical about using 2PC technology across loosely coupled application systems. I'm of the opinion that we need to devise a new approach to manage loosely coupled transactions. There is such an effort underway at OASIS (www.oasis-open.org), called Business Transaction Processing (BTP). You might find this article on BTP enlightening.
But BTP is still a future. There are no implementations today.
The way you solve it today is to build transaction recovery into your applications. If part of your extended transaction fails, you must manually undo the other parts that have been committed. These "undo" methods are known as compensating transactions. It's not pretty, but it's the only viable approach today.
This was first published in February 2002