4 Replies Latest reply on Feb 5, 2008 6:47 AM by kadlecp

    wst vs. wstx



      I have complete mess between those two abreviations. I can see two TransactionManagers, one in wst package, one in wstx package. There are two UserTransaction classes as well.

      I assume that these two abbrevs are two different specifications....
      Why wst UserTransaction does not contain setRollbackOnly method? The xts demo uses wst UserTransaction, so I would like to use that class.... But I would like that web service transaction participant would be able to set the global transaction to rollbackOnly...

      The wstx UserTransaction has setRollbackOnly method....
      Can I use wstx UserTransaction in the analogous way as wst UserTransaction?

      Thanks for your help
      Pavel Kadlec

        • 1. Re: wst vs. wstx

          For my purposes it would be enough if web service transaction participant would call rollback instead of rollbackOnly. But I am not sure if it is correct solution from the specification point of view...

          I just want to solve the case when web service transaction participant knows that the transaction should be rolled back.

          • 2. Re: wst vs. wstx
            Andrew Dinn Master

            The two UserTransaction classes you mention are not the same.

            The wstx UserTransaction provides an API which supports nested transactions i.e. if you call begin while a transaction is active it will enter a subtransaction and the next commit or abort will be performed relative to the enclosing transaction but will not be visible to other transactions until the outermost tx is committed. This will not be appropriate unless the resources participating in your transaction support nested transactions.

            The wst UserTransaction will reject any attempt to begin a transaction from within an existing transaction throwing an illegal state exception. This the expected behaviour for transactions conforming to the JTA model.

            If you want to roll back the transaction what is wrong with calling userTransaction.rollback()?

            • 3. Re: wst vs. wstx
              Mark Little Master

              Use the one mentioned in the documentation.

              • 4. Re: wst vs. wstx

                Thank you very much for answers,

                I do not need nested transactions, so I will use "wst transactions".

                If you want to roll back the transaction what is wrong with calling userTransaction.rollback()?

                Maybe nothing. I have similar model using JTA transactions, not WS-Transactions. And if JTA participant knows that JTA transaction should be rolled back, the participant marks the transaction to rollbackOnly. My special aggregator aggregating responses from participants then calls rollback. I like the idea that participant don't call rollback, but only marks tx to rollbackOnly. The commit, rollback is job of somebody else, the aggregator.

                So conclusion, my ws participant will call userTransaction.rollback() when some business error arises...