aspose file tools*
The moose likes Web Services and the fly likes webservice and distributed tx Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "webservice and distributed tx" Watch "webservice and distributed tx" New topic
Author

webservice and distributed tx

satish bodas
Ranch Hand

Joined: Jun 19, 2008
Posts: 116
Hello ,
I am new to web services and have a question ::


Scenario ::
Need to invoke a web service that would store some information in db
also would need to myself write some data to a local db

So essentially have to perform two operations
will be using a sateless session bean ( ejb 3.0 )

If the order of operations is ::
1 >invoke web service
2 >write to local db

If there are errors while I try and write to local db - can the data in web service be reversed ?

one solution could be first write to local db .....

However I want to first invole web service

Thanks ,
~satish
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
WS by themselves have no notion of being part of a transaction, so you'd need to call some other WS operation to undo the DB operation if the TX fails later.

The BPEL standard (which can orchestrate several WS calls into a single one) has the notion of "compensating actions" which could be used for this. But using BPEL just for this would mean a nontrivial amount of overhead, and wouldn't be a good fit to begin with if parts of the operation happen locally.


Ping & DNS - updated with new look and Ping home screen widget
arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3216
If the DB operation succeeds make a WS Call. If the WS call fails roll back the DB operation.


Java Interview Questions and Answers Blog | Amazon.com profile | Java Interview Books
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: webservice and distributed tx
 
Similar Threads
Is use of singleton-pattern questionable?
webservice client best practices
new to soap web service
Use of DAO as a Command?
Connection Object for lock/unlock...?