Here are my requirements of the web service (.NET 1.1, XP/2003)
(1) It needs to call a COM+ application that has already been written and
deployed. The web service essentially becomes a client to the COM+
application.
(2) The web service needs to initiate a new transaction when calling the
COM+ application, then it needs to complete or abort EXPLICITLY.
A million dollar question.....
How can I do this? My web service class is obviously derived from
System.Web.Services.WebService. I have a web method decorated with
TransactionOption.RequiresNew. The web method calls the COM+ application to
write stuff to database. I know that if the web method returns normally, the
transaction is implicitly complete. Likewise, if an exception is thrown, the
transaction is implicitly aborted. However, I must write the code EXPLICITLY
and say "abort transaction" even when there is no exception being thrown in
the web method.
I simply inserted "ContextUtil.SetAbort()" (from System.EnterpriseServices
namespace) where I wanted to explicitly abort the transaction within the web
method. But I got an error (There is no MTS object context).
This is not about writing a COM+ component so I don't think I need to write
a custom class deriving from ServicedComponent (this is impossible to do with
the web service anyways since the web service class itself is already derived
from System.Web.Services.WebService as mentioned before). Rather, this is
about writing a COM+ client from within a web service.