19.2. Creating Client Applications
There are two aspects to a client application using XTS, the transaction declaration aspects, and the business logic. The business logic includes the invocation of Web Services.
Transaction declaration aspects are handled automatically with the XTS client API. This API provides simple transaction directives such as
begin
, commit
, and rollback
, which the client application can use to initialize, manage, and terminate transactions. Internally, this API uses SOAP to invoke operations on the various WS-C, WS-AT and WS-BA services, in order to create a coordinator and drive the transaction to completion.
19.2.1. User Transactions
A client uses the
UserTransactionFactory
and UserTransaction
classes to create and manage WS-AT transactions. These classes provide a simple API which operates in a manner similar to the JTA API. A WS-AT transaction is started and associated with the client thread by calling the begin
method of the UserTransaction
class. The transaction can be committed by calling the commit
method, and rolled back by calling the rollback
method.
More complex transaction management, such as suspension and resumption of transactions, is supported by the
TransactionManagerFactory
and TransactionManager
classes.
Full details of the WS-AT APIs are provided in Chapter 21, The XTS API.