Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 run a web service inside a trigger?

Author  Topic 

DanDan
Starting Member

7 Posts

Posted - 2007-08-08 : 02:35:38
Dear all

Is it possible to run a web service from inside a trigger?

I would like to use the table "INSERTED i" and pass few parameters i extract from there to a web service which will talk to a third party application.

Sincerely
Dan

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2007-08-08 : 10:20:58
you might have problems with data consistency. what happens if the update to this table is part of a larger transaction that gets rolled back? if your trigger has fired and already sent the data to the web service what do you do? What if the web service is unavailable, does your DB transaction fail becuase of this? Not to mention the possible performance implications of putting something like this into a even modestly busy system.

Maybe a better solution is to put the data you want to send to the web service into a staging table via the trigger you are talking about. then at some regular interval you could process the staging table and send that to the web service. This way SQL can maintain data consistency and you can still have your trigger.



-ec
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-08 : 10:49:16
do you want to send data from the trigger to a webservice or have a webservice in sql server that the 3rd party app is talking to?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

DanDan
Starting Member

7 Posts

Posted - 2007-08-08 : 19:08:38
i would like to have data from the trigger passed to a web service.

the web service will then communicate with a third party application and send the data from the trigger to it.

pretty much the web service is the middle man in this situation
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-08 : 19:22:15
nope no can no with ease. not to mention this is a bad idea altogether.

this thread explains a bit of pain doing what you need:
http://www.pluralsight.com/blogs/keith/archive/2005/06/21/11647.aspx

CLR, assembly signing.. shudder... i wouldn't recommend it

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -