locked
TransactionScope with web services RRS feed

  • Question

  •  

    Hello,

    I am trying to solve this issue:

    I am writing a webservice which does the following

    1) It takes some domain objects in the web service request and dumps it into the database.There are some validation before it actualy dumps it in DB. This DB is a local DB.

    2) After this is done It calls another webservice which doenst return anything. If there is error on the other webservice side it will return a soapexception.

    Now the issue is

    If this web service returns any error i NEED  to rollback what ever I did in my database,

    or

    If I call the webservice first and then do some updates, still if there is error while doing updates in my database, there will be sync issues coz the other webservice didnt return any error.

    In this scenario, Can I use transactionScope form ADo.net 2.0....

    what wwould be the best approach.

    Thanks,
    RN

    Tuesday, April 15, 2008 5:10 PM

Answers

  • Since web services rely on the http protocol and it's stateless, there is no way to provide any means of transactions outside of the scope of a single web method call.  You can read more here.  You may want to reconsider how you are structuring your code/calls.  Try to group everything that needs to be in a transaction into a single web method call which would therefore support transactions.
    Tuesday, April 15, 2008 8:47 PM