March 28, 2005 at 8:22 pm
Hello all,
Does anyone have an idea of how to trigger calling an asp or aspx page from within a stored proc or a DTS package?
Mark
March 28, 2005 at 9:48 pm
Maybe a bit more information about what you're trying to achieve would allow a more informative answer
--------------------
Colt 45 - the original point and click interface
March 29, 2005 at 12:50 am
If you are trying to generate a web page from a stored procedure then use sp_makewebtask.
If you are trying to call a web page as you would for a web service then the simplest way is to write an ActiveX control and register it on your box. You can then use sp_OACreate to instantiate it and perform your evil deeds.
Personally I do not allow ActiveX controls to be installed on my servers.
The route I prefer is to have the ActiveX control and calling mechanism on a separate box with very specific permissions for reading and writing to SQL Server
March 29, 2005 at 6:06 am
In this case the customer has built web pages that execute a variety of functions. So I am not looking to do a sp_makewebtask.
The existing pages can be launched from a PDA browser, a normal browser and now they want to launch them from a proc which would be called from within a trigger. These pages do not return anything visual just start up processing runs.
They are not big on having any custom controls built or existing on their servers. So my request is a challenging one. How to issue a HTTP call from within SQL Server?
Mark
P.S. Thanks for the first round of ideas.
March 29, 2005 at 5:41 pm
just an idea.
Script to call iexplore.exe with url, then close itself after certain time.
xp_cmdshell to call the script.
March 30, 2005 at 7:28 am
I think this is what your looking for:
Sample Call:
exec spSelect_CallWebPage 'http://www.google.com'
CODE:
CREATE PROCEDURE [dbo].[spSelect_CallWebPage]
(@URL varchar(1000))
AS
DECLARE @vPointer INT,
@vResponseText VARCHAR(8000),
@vStatus INT,
@vStatusText VARCHAR(200)
EXEC sp_OACreate 'WinHttp.WinHttpRequest.5.1', @vPointer OUTPUT
EXEC sp_OAMethod @vPointer, 'open',NULL, 'GET', @URL,0
EXEC sp_OAMethod @vPointer, 'send'
EXEC sp_OAMethod @vPointer, 'Status', @vStatus OUTPUT
EXEC sp_OAMethod @vPointer, 'StatusText', @vStatusText OUTPUT
EXEC sp_OAMethod @vPointer, 'responseText', @vResponseText OUTPUT
EXEC sp_OADestroy @vPointer
Select @vStatus as Status, @vStatusText as StatusText, @vResponseText as ResponseText --|200 ||OK ||<HTML> Result Trimmed||
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply