0

I'm not sure why I'm having such a hard time finding an answer without asking.

I have SQL Server 2016. Trying to figure out how to call a REST web service from a Procedure. Do I use OLE Automation Procedures? MSXML2.ServerXMLHttp? Or is there something built in? I would rather not use CLR.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
MotKohn
  • 3,485
  • 1
  • 24
  • 41
  • 2
    Calling a web service from a stored procedure is highly unorthodox. Why do you want to do this? – Sean Lange Jun 15 '17 at 14:52
  • for a notification – MotKohn Jun 15 '17 at 14:53
  • Also try https://stackoverflow.com/a/22107134/15393 – RB. Jun 15 '17 at 14:54
  • 2
    Well that is a vague explanation. – Sean Lange Jun 15 '17 at 14:54
  • I have to notify a service of an action. – MotKohn Jun 15 '17 at 14:55
  • 3
    When you have to start using sp_OACreate it is a sign that you are trying to do something in a way that should be reconsidered. This is exactly the kind of situation where CLR is the obvious choice. – Sean Lange Jun 15 '17 at 14:56
  • 1
    Send a message to a service broker queue that is read by an external service (written in a language of your choice) that makes the call for you. Overkill? Possibly, depending on your scenario. More scalable and reliable? Very much so. – Jeroen Mostert Jun 15 '17 at 15:00
  • Calling REST services, sending notifications, is the job of external services, scheduled jobs, web applications, SSIS scripts. It's not the job of the database. External services are **SLOW** compared to the database. Calling them will result in increased locking and performance degradation. That's why you can't find any solution except "Don't Do It" – Panagiotis Kanavos Jun 15 '17 at 15:01
  • 1
    If you want to send notifications based on data, create an SSIS package that reads the relevant data and sens the notifications, then schedule it to run as often as required. – Panagiotis Kanavos Jun 15 '17 at 15:04
  • @MotKohn as for notifying services of actions, the originator of the action should do that - that's the web application or service that called the database in the first place – Panagiotis Kanavos Jun 15 '17 at 15:05

0 Answers0