NON-DB TRANSACTIONS in ASP.NET

Last post 07-30-2007 8:26 AM by naturehermit. 2 replies.

Sort Posts:

  • NON-DB TRANSACTIONS in ASP.NET

    07-28-2007, 2:10 PM
    • Loading...
    • hkbetchoo
    • Joined on 05-26-2007, 9:58 PM
    • Posts 2

    Hello there!

    This is thread is related to XML Web Services Transactions in ASP.NET.

    I have a web service called Orchestration which calls other web services like Flight, Hotel and Payment.

    All the web services have web methods with TransactionOption=Required and AutoComplete attribute including the Orchestration web service web method which calls the other web services.

    The orchestration web service calls the flight, hotel and payment asynchronously, i.e. in parallel. In the payment web service, a credit card is validated and sends a confirmation mail to the credit card holder if the payment is authorised. I am using gmail SMTP to send mail.

    If the flight or hotel fails but the payment web service succeeds, the payment web service should be rolled back. I thought that this would be taken care automatically but I have noted that the confirmation mail is sent although there is an exception in the orchestration service.

    My aim is that the payment service should be rolled back, i.e the mail should not be sent when the flight or hotel service crashes. Does transactions cater for DB operations only? I have noted that if an exception occurs in autocomplete transactions, DB operations are automatically rolled back but the mail operation is not rolled back. Is there a way to cater for non-db operations as well?

    Grateful if anyone of you could help me on this.

    Thanks,
    Kaushik

     

  • Re: NON-DB TRANSACTIONS in ASP.NET

    07-29-2007, 4:43 PM
    • Loading...
    • NielsV
    • Joined on 07-29-2007, 3:14 PM
    • The Netherlands
    • Posts 7

    Sending e-mail is an action that can't be rolled back, and because your services are run in parallel, the email will be send at the same time the hotel service executes. I think it'll be better if you execute the payment service after the other two services are run (but still in the same transaction).

    It is possible to write your own rollback mechanisms, but still, if you drop your mail on the wild internet, the rollback option for your mail is gone ;)

  • Re: NON-DB TRANSACTIONS in ASP.NET

    07-30-2007, 8:26 AM

    Well bearing in mind the above is true, why not make those fields as compulsory. I.e. check if anyone step fails, the field gets failed and hence the code fails with an error rather then sending the email.

    Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
Page 1 of 1 (3 items)
Microsoft Communities
Page view counter