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
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