Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2004
    Posts
    1

    Unanswered: Call webservice from trigger/stored proc

    Is it possible to call an external web service from a SQL Server trigger or stored procedure?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    You can sort of call a web service from a stored procedure, but it takes a lot of bubble gum and bailing wire to make it work. Can you describe what you want in a bit more detail, and one of us might have an idea or three that might help.

    -PatP

  3. #3
    Join Date
    Oct 2005
    Posts
    1

    calling web service from stored procedure

    Hi
    I want to call the web services which is developed in .net from sqlserver 2000.So please do help me.

  4. #4
    Join Date
    May 2002
    Posts
    299
    Here is a sample code (without error handling):

    Code:
    declare @objRef int 
    ,@resultcode int
    ,@responseText varchar(8000) 
    
    
    
     EXEC @resultcode = sp_OACreate 'MSXML2.ServerXMLHTTP', @objRef OUT,4 
     EXEC @resultcode = sp_OAMethod @objRef, 'Open', NULL,'GET','http://myurl.com', False 
     EXEC @resultcode = sp_OAMethod @objRef, 'Send',null 
     EXEC @resultcode = sp_OAGetProperty @objRef, 'responseText',@responseText output 
     
    print(@response)
    
     EXEC sp_OADestroy @objRef
    --
    -oj
    http://www.rac4sql.net

  5. #5
    Join Date
    Apr 2009
    Posts
    1
    Hello!

    Declaration of @response is missing.

    If I use @responseText instead then I get back value of Null.

    Thank you!

  6. #6
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270
    How can we read the output here? @responseText returns NULL value......

  7. #7
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    calling a webservice from a trigger will kill the perf of your system.

    you might consider doing it asynchronously, either with service broker or agent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •