• 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

Web Service and Transaction

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a UI (basically a mobile client), which has a Button which when I clicked executes a process in the background. THis background process basically uploads data to the server via a webservice which is loaded into a DB. In the foreground after I click the button it shows a new screen with a progress bar and a cancel button below it. If I click the Cancel Button, I need to undo whatever data I have uploaded to the server via the web service.
The background process is executed via seperate thread in the client side that also calls the webservice.

I have a few questions:
1.Does this process qualify for a transaction kind of scenario?If yes how do I implement Transactions on Server side for this?
2. If this does not qualify for transaction what do I do? As I am building the background process as a seperate thread do I just stop the background thread if the cancel button is clicked, but then again the data already send to the Web Service, how will the webservice behave?

Any help Appreciated
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Implement a method in webservice which simply set flag which can indicate that process is cancelled or not.
Execute the method when you hit "Cancel"
When your db changes finished check the flag, if process is cancelled then rollback transaction otherwise commit it.

Thanks
 
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would not attempt long-running transactions over the wild wild web. I would upload the data to a staging database. Once the data is uploaded, in addition to validating that the data is correct, move it to the regular database (using transactions). If the user clicks cancel then remove the loaded data from the staging database.
reply
    Bookmark Topic Watch Topic
  • New Topic