Nested transactions in a web service

S

Steve

I have a couple of questions about transactions in webservices.

1. The help for the WebMethodAttribute.TransactionOption Property says
the following ...

"If an XML Web service method, with a TransactionOption property of
Required or RequiresNew invokes another XML Web service method with a
TransactionOption property of Required or RequiresNew, each XML Web
service method participates in their own transaction, because an XML
Web service method can only act as the root object in a transaction."

what will happen in the following situation if w3.b() throws an
exception? will all the transactions be rolled back i.e. the changes
made in w2.a()? Or will the changes made in w2.a() remain because it
has its own transaction

//WebService1
[WebMethod(TransactionOption.RequiresNew)]
public sub a(){
WebService2 w2 = new WebService2()
WebService3 w3 = new WebService3()

... //do some work - makes changes to a database

w2.a()
w3.b()
}


//WebService2
[WebMethod(TransactionOption.Required)]
public sub b(){
//makes changes to a different database
}

//WebService3
[WebMethod(TransactionOption.Required)]
public sub c(){
//makes changes to yet another database
}


Cheers,

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top