Created
July 8, 2015 15:23
-
-
Save jbnv/19f36d329e992a319e34 to your computer and use it in GitHub Desktop.
Calling a Web service from T-SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @Object AS INT; | |
DECLARE @ResponseText AS VARCHAR(8000); | |
EXEC sp_OACreate 'MSXML2.XMLHTTP', @Object OUT; | |
EXEC sp_OAMethod @Object, 'open', NULL, 'get', | |
'http://www.webservicex.com/stockquote.asmx/GetQuote?symbol=MSFT', --Your Web Service Url (invoked) | |
'false' | |
EXEC sp_OAMethod @Object, 'send' | |
EXEC sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT | |
SELECT @ResponseText | |
EXEC sp_OADestroy @Object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment