Quoting Jack Wang <[EMAIL PROTECTED]>:

Let us assume a money transfer. You invoke the 2 services:

Bank1.debit(acc1, dollars);
Bank2.credit(acc2, dollars);

Now Bank1 and Bank2 services could be running on hosts H1, H2 (H2 could be the 
same as H1) which we do not care.

Say you have Kandula running on host H3 (could be the same as H1 or H2). Then 
you MUST set kandula.context to:

http://H3:port/axis/services/
 
and call your operations like this.

wstm.begin("http://H3:port/axis/services/activationCoordinator";);
Bank1.debit(acc1, dollars);
Bank2.credit(acc2, dollars);
wstm.commit();

Note that the new o.a.k.coordinator.at.TMimpl expects to be called from within 
a ws container where kandula is deployed-- if you call it from a standalone 
your tx will work but the "commit" method will hang expecting a "Committed" 
message which cannot be received this way.


Say now, that YOU are providing Bank1 (or Bank2 or both)

Now when you create a DataSource in JDBC it gives you an XAResource interface. 
You must register this XAResource interface with the local j2ee tx.

e.g.

Bank1.creditImpl(acc, dollars) {

xaRes = createConnection("JDBC:connection string");
Transaction tx = tm.getTransaction();
tx.enlistResource(xaRes);

// SQL statements

tx.delistResource(xaRes);
}

This usually happens transparently if your TM and DB are properly hooked up to 
your container-- say Tomcat. (However, I've not seen any docs on how to to do 
this with Geronimo but certainly it is possible.)

Notice that there are 2 parallel sets of interfaces. 
o.a.k.coordinator.at.TransactionImpl, 
o.a.k.coordinator.at.TransactionManagerImpl and javax.transaction.Transaction,
javax.transaction.TransactionManager.

When you use j2ee (or JDBC) for distributed transactions using ws-at/kandula, 
your application will NOT directly get itself involved in ws-at protocol.
instead it will as usual work with JTA. However, behind the scene, kandula will 
tie up your local JTA tx with the corresponding (global) ws-at tx so that your 
local tx becomes a branch of the global tx.

--dasarath

> 
>     Now I get point that I only need WS_AT , not Kandula Business activities
> support. So If
> kandula team provide a WS_AT example as soon as possible, kandula will meet
> my need. Here is the
> "Web Services Atomic Transaction example Requirement (Updated From IBM)". The
> attachment is the
> original file. 
> 
>     Web Services Atomic Transaction example Requirement 
>     -----------------------------------------------------
> 
>     The Web Services Atomic Transaction (WS-AT) sample demonstrates the use
> of distributed two
> phase commit (2PC) between a Web service client and the target Web service.
> The sample application
> is an example of a possible implementation of an e-business selling products
> business-to-consumer
> (B2C), using Web services as a key part of the internal infrastructure of the
> e-business. 
>       
>     The sample has been designed so that it can be run on multiple servers,
> as such the Web
> service client can be deploied in one Web application server(Machine A) and
> the target Web service
> can be deploied in another Web application server(Machine B).
>       
>     The Web service client provids the main application logic, a set of
> entity beans facilitating
> database access, and a Web application (servlets and Java Server Pages)
> providing the end user
> with an easy way to interact with the sample through a Web browser.
>       
>     The Shop bean uses the entity beans to manipulate customer information
> and makes Web Service
> requests on the Stock Web service to manipulate stock data.  
> 
>     The Stock Web service accesses data in a database containing stock level
> data through an
> entity bean (the Stock bean).
> 
>     When a purchase is made the Web service and Web service client both make
> changes to their
> databases.  These changes must be coordinated, otherwise the stock computer
> could order too much
> stock, or a customer may get billed without stock being sent.  A distributed
> transaction is used
> to ensure consistency of the data between the two databases. 
> 
>     When a user confirms an order, updates are required to both databases. 
> The customer database
> is updated with the details of the new order the customer has now placed for
> tracking/audit
> purposes.  The stock database is also updated since the stock levels need to
> be updated to reflect
> that the ordered stock is now unavailable for any future orders.  These
> updates need to be
> coordinated in a single global transaction. 
>       
>     In the sample, a transaction is started when the web application calls
> the application logic
> in the Shop bean to confirm an order. 
> 
>           -------------------------------------------
> 
> --- Dasarath Weeratunge <[EMAIL PROTECTED]>дµÀ:
> 
> > Quoting Jack Wang <[EMAIL PROTECTED]>:
> > 
> > Thanks a lot Jack. Let's start a Wiki page for this so that we could all
> modify 
> > it easily. I changed some of the steps. You no longer need jotm to use
> Kandula. 
> > Kandula now runs on Geronimo TM. It also downloads all the required jars at
> 
> > build time. However, I have not tested how to integrate the Geronimo TM
> with 
> > Tomcat. If you have any questions on this matter please drop in a mail to
> the 
> > Geronimo User list. Modifications to Kandula code may also be required to 
> > prevent 2 instances of the TM being active. At present the Kandula tx
> Bridge 
> > instantiates the TM and a reference to this could be obtained by calling 
> > Bridge.getTM(); This procedure surely has to be changed. The code for this
> is 
> > in the o.a.k.geronimo package.
> > 
> > I couldn't read the last couple of steps in detail where you talk about how
> to 
> > add a new sample. If you could send the code I could commit that as a new 
> > sample. I think we could use a simpler example.
> > 
> 
>    I am looking for the knowledge about WS_AT and kandula yet, so I give the
> sample requirement
> first. As for WS_AT sample code, I am afraid it is too difficult to me. :-)
> 
> Thanks
> 
> 
> > 
> > thanks,
> > --dasarath
> > 
> > 
> > >     
> > >     Dasarath, I write up the steps for your reference, please see the
> > > attachment. I did not test
> > > the staps step by step this time. I have some other questions when I put
> > > database
> > > operation(transaction) and web service call(transaction) in kandula
> > > transaction. I will write
> > > another mail. Thanks.
> > >     
> > >                           
> > > 
> > > Wang Jun
> > > 
> > > 
> > >           
> > > ___________________________________________________________ 
> > > ÑÅ»¢1GÃâ·ÑÓÊÏä°Ù·Ö°Ù·ÀÀ¬»øÐÅ 
> > > http://cn.mail.yahoo.com/
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> Wang Jun
> 
> 
>               
> ___________________________________________________________ 
> ¿ìÀ´ÑÅ»¢ÓÊÏä·¢ºØ¿¨£¬°Ý´óÄêÀ²£¡ 
> http://cn.mail.yahoo.com/promo/greetings/
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to