Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I make HTTP request from SQL server?
    primarykey
    data
    text
    <p>I wanted to send an HTTP request from SQL server to Tomcat server. I have installed SQL server 2012 express and non .NET application in Tomcat server. I have gone through this like <a href="http://networkprogramming.wordpress.com/2010/09/01/make-a-http-request-from-sql-server/" rel="noreferrer">Make a HTTP request from SQL server</a></p> <p>As it says in the above article, "The COM object WinHttp.WinHttpRequest.5.1 must be installed on the server, some typical variations are WinHttp.WinHttpRequest.5". I have downloaded winhttp.zip from the <a href="http://www.dll-files.com/dllindex/dll-files.shtml?winhttp" rel="noreferrer">winhttp download link</a>, found winhttp.dll in the zip folder and pasted it in <code>C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2\MSSQL\Binn</code> as suggested in this <a href="http://msdn.microsoft.com/en-us/library/ms164653.aspx" rel="noreferrer">msdn link</a>.</p> <p>Following that same advice, I have executed following line in SSMS:</p> <pre><code>sp_addextendedproc 'GetHttp', 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2\MSSQL\Binn\winhttp.dll'; </code></pre> <p>I also executed the following code in SSMS as said in "Make an HTTP request from SQL server link":</p> <pre><code>Alter function GetHttp ( @url varchar(8000) ) returns varchar(8000) as BEGIN DECLARE @win int DECLARE @hr int DECLARE @text varchar(8000) EXEC @hr=sp_OACreate 'WinHttp.WinHttpRequest.5.1',@win OUT IF @hr &lt;&gt; 0 EXEC sp_OAGetErrorInfo @win EXEC @hr=sp_OAMethod @win, 'Open',NULL,'GET',@url,'false' IF @hr &lt;&gt; 0 EXEC sp_OAGetErrorInfo @win EXEC @hr=sp_OAMethod @win,'Send' IF @hr &lt;&gt; 0 EXEC sp_OAGetErrorInfo @win EXEC @hr=sp_OAGetProperty @win,'ResponseText',@text OUTPUT IF @hr &lt;&gt; 0 EXEC sp_OAGetErrorInfo @win EXEC @hr=sp_OADestroy @win IF @hr &lt;&gt; 0 EXEC sp_OAGetErrorInfo @win RETURN @text END </code></pre> <p>Then I get the error</p> <blockquote> <p>Msg 2010, Level 16, State 1, Procedure GetHttp, Line 2<br> Cannot perform alter on 'GetHttp' because it is an incompatible object type.</p> </blockquote> <p>I do not know how to call the function to send the HTTP request. I assume it is something like this <code>GetHttp('http://www.google.co.in/')</code>.</p> <p>What am I missing?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload