Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Transact SQL Send String via HTTP
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Transact SQL Send String via HTTP
Divers
Thread ID:
00762886
Message ID:
00762886
Vues:
94
I am trying to send and XML formatted string to a web page from SQL Server (version 7). I have managed to get most of this working using sp_OACreate but cannot get the send syntax correct (I am guessing). Does anyone have any experience with this? All of the examples I find are either receiving a document or are VB examples which have a different syntax from SQL Servers stored procedures. Here is what I have:
	DECLARE @iresult INT,
		@ihttp INT,
		@csrc VARCHAR(255),
		@cdesc VARCHAR(255),
		@istat INT,
		@XMLOutput VARCHAR(8000)


	EXEC @iresult = sp_OACreate 'MSXML2.ServerXMLHTTP', @IHTTP OUT
	IF @iresult != 0
	BEGIN
	print 'Create'
		EXEC sp_OAGetErrorInfo @ihttp, @csrc out, @cdesc out
		SELECT result = CONVERT(varbinary(4), @iresult), source = @csrc, descrip = @cdesc
	END

	EXEC @iresult = sp_OAMethod @ihttp, 'open', NULL, 'POST', @WebPage, 'false'
	IF @iresult != 0
	BEGIN
	print 'Open'
		EXEC sp_OAGetErrorInfo @ihttp, @csrc out, @cdesc out
		SELECT result = CONVERT(varbinary(4), @iresult), source = @csrc, descrip = @cdesc
	END

	EXEC @iresult = sp_oamethod @ihttp, 'send', null, @XMLString

	IF @iresult != 0
	BEGIN
	print 'Send'
		EXEC sp_OAGetErrorInfo @ihttp, @csrc out, @cdesc out
		SELECT result = CONVERT(varbinary(4), @iresult), source = @csrc, descrip = @cdesc
	END

	EXEC @iresult = sp_OAGetProperty @ihttp, 'Status', @istat OUT
	print 'Stat: ' + convert(varchar,@istat)
	EXEC @iresult = sp_OAGetProperty @ihttp, 'responseText', @xmloutput OUT
	print 'xmlout: ' + @Xmloutput
	PRINT @xmloutput

	EXEC @IRESULT = SP_OADESTROY @IHTTP

	PRINT @XMLString
The print statements are for debugging purposes. I end up getting the error:
0x80040005 ODSOLE Extended Procedure Code Execution Exception: EXCEPTION_ACCESS_VIOLATION

Thanks for any help you can provide.

George
Everything we see or seems
Is but a dream within a dream
- Edgar Allen Poe
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform