• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

webservice and distributed tx

 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
arulk pillai
Author
Ranch Hand
Posts: 3387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the DB operation succeeds make a WS Call. If the WS call fails roll back the DB operation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic