Wednesday, March 21, 2012

MSXML in Win Server 2003

Hi,

I have been using 'MSXML2.ServerXMLHttp.4.0' to make web requests from SQL server with no problems for about 6 months now (on Win2K Servers).

Now trying to move the databases onto a new 2003 server and getting the well known 'Access denied' error message. I beleive I have sorted out the following:

- Execute permissions on the master database for sp_OACreate, sp_OAGetErrorInfo,....
- Allowed 'All unkown ISAPI Extensions' - not that I'm happy about that!!
- Uninstalled the 'Internet Explorer Enhanced Security Configuration'
- I have enabled 'Submit nonencrypted form data' for the relevant zones in IE Security Settings

But none of these seem to have had an effect. I have also tried using WinHTTP.WinHTTPRequest.5.1 as suggested in a MS KB article, but this is not suitable as I need to pass authenitication parameters with each request, and it seems as though the response size is limited.

If anyone has any tips/checklists for getting this going I would be very interested.

TIASolved it!

My inablility to read MS Info, for others here is a very stripped down version:

exec @.hr = sp_OACreate 'WinHTTP.WinHTTPRequest.5.1', @.obj OUT

IF @.hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @.obj, @.src OUT, @.desc OUT
goto eh
END

exec @.hr = sp_OAMethod @.obj, 'open', NULL, "GET", @.sUr

IF @.hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @.obj, @.src OUT, @.desc OUT
goto eh
END

exec @.hr = sp_OAMethod @.obj, 'SetCredentials', NULL, 'USERNAME', 'PASSWORD', '0'

exec @.hr = sp_OAMethod @.obj, 'send'
IF @.hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @.obj, @.src OUT, @.desc OUT
goto eh
END

exec @.hr = sp_OAMethod @.obj, 'status', @.status OUT
IF @.hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @.obj, @.src OUT, @.desc OUT
goto eh
END

IF @.status <> 200
BEGIN
SET @.desc = 'HTTP request failed. Server returned status of ' +cast(@.status as varchar) + '.'
goto eh
END

exec @.hr = sp_OAGetProperty @.obj, 'responseText', @.response OUT
IF @.hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @.obj, @.src OUT, @.desc OUT
goto eh
END

exec @.hr = sp_OADestroy @.obj
return 0

eh:
exec @.hr = sp_OADestroy @.obj
Raiserror(@.desc, 16, 1)sql

No comments:

Post a Comment