• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

webservice and distributed tx

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 3473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the DB operation succeeds make a WS Call. If the WS call fails roll back the DB operation.
 
Nothing? Or something? Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic