dutchman's log
Distributed transaction sample: part 1 - introduction
This and the next couple of entries in this log are about execution of distributed transactions involving Java CAPS BPEL, EJB web services, WCF (.NET Windows Communication Foundation) web services, and an Oracle database. System and environment setup and creation and running of a sample application will be discussed.
Java and WCF interoperability is the subject of Web Services Interoperability Technologies (WSIT) (previously known as Project Tango), a Sun-led project in which Microsoft and Sun work together to ensure web services based interoperability between the two environments. You can find more information on WCF and Java web services interoperability on the WSIT web site.
What is a transaction?
Lots of information about transactions is available on the Internet. A possible starting point for more information is Transaction Processing.
Just as a short recap:
-
Atomic means that the transaction is executed entirely or not at all.
-
Consistent means that the data underlying the transaction is in a consistent state before the transaction and when the transaction has finished (successfully or not).
-
Isolated means that the actions in the transaction are executed in isolation. The outside world doesn't see the results until the entire transaction has finished.
-
Durable means that the effect of the transaction is persistent. It does not disappear, it survives system restarts, and will not be undone (unless by another transaction).
Distributed transactions are transactions that execute their actions in different environments, possibly (likely) running on different machines. Ensuring that distributed transactions have ACID properties is more complex than doing this for transactions that run in a single, non-distributed environment.
The sample
The sample application that will be dealt with in these log entries does not do anything useful, except demonstrate transactional capabilities involving Java CAPS 6, EJB web services, WCF, and Oracle.
The example application looks like this:

The BPEL process starts the transaction and, when all required actions are executed, ends it. The transaction can be ended successfully, in which case it will be committed, or it can be terminated with an error, in which case it will be rolled back.
The actions to be executed by the BPEL process are determined by values in the WSDL used to invoke the BPEL process. Transaction commit or rollback is also determined by a value in the WSDL.
The various parts of the transaction will write messages to the system log (GlassFish) or the console screen (WCF). By checking these messages and the resulting data in the Oracle database, correct working of the entire distributed transaction can be verified. When the transaction is committed, the database should contain the rows written during the transaction; when the transaction is rolled back, these rows should not be present.
More details are to be found in this log, in the entries describing how the sample was built.
Working around some limitations
This example was built using the GA release of Java CAPS 6 for the Java CAPS/GlassFish part. To communicate with external web services, the BPEL module uses the HTTP Binding Component (HTTP-BC). In the version of Java CAPS used, the HTTP-BC does not support SOAP 1.2. The WCF service uses SOAP 1.2, so direct communication is not possible. To overcome this limitation, an EJB was created that implements a SOAP 1.1 interface, and is client for the SOAP 1.2 WCF service. This EJB implements exactly the same operations with the same parameters as the WCF service. It picks up the parameters of the input requests, copies them to the WCF request, and then invokes the WCF operation via SOAP 1.2. The EJB is just a proxy for the WCF service.
In the Java CAPS version used, a BPEL process can not initiate a transaction when it starts. An atomic BPEL process can participate in a transaction that is active when the process is started. This means that our BPEL process can not be the head of a transaction.
Combining these two properties, a way to work around the limitations described here, is to create a new BPEL process that invokes the process running our transaction. The new BPEL process is a proxy for the main process. It takes the input parameters, copies them and invokes our main process. The invoke will start a transaction and end it when the invoked process returns. The new BPEL process is a proxy for our main process.
The resulting application looks like this:

The next couple of entries in this log will talk about how to set up a system and environment to run this application, and how to create the application itself.
Posted at 12:01PM Sep 01, 2008 by marjo in Distributed transaction | Comments[2]
Monday Sep 01, 2008
I can't wait to see the next entries.
Thanks a lot.
Posted by Arturo M on August 18, 2008 at 02:39 PM CEST #
very bad
Posted by Sanjib Pradhan on October 30, 2009 at 09:11 AM CET #