Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
darrenkelly
Starting Member
2 Posts |
Posted - 2003-03-27 : 07:08:29
|
Hi, I hope someone can help me here. From an .ASP page I receive an XML feed parse it and enter it into the database. Then an SP manlipulates the data. Depending on the outcome I need the SP to send an XML string back to an .ASP page on a Web Server. I use the following code which is causing me an error when I try and send data. It comes up with the following error "Error Message: sp_OAMethod usage: ObjPointer". Does anyone know why. Also when I open the URL does anyone know why NULL is required as a parameter??? I am not sure I am on the right track or what I am trying to do is possible in this context. Any information would be greatly appreciated. Below is the code I am using....Many thanks.----DECLARING Stored Procedure VariablesDECLARE @Sp_Name varchar(100)DECLARE @Return_Value integerDECLARE @Error_Message varchar(200) --@Error_No IF 0 all is okay, if anything else something is wrong.DECLARE @Error_No integerDECLARE @XMLDoc intDECLARE @src varchar(255)DECLARE @desc varchar(255)Declare @URL varchar (255)Declare @XML varchar (255)--SETTING Stored Procedure VariablesSET @Sp_Name = '_sp_SendXML'SET @Return_Value = 0SET @Error_Message = ' 'SET @Error_No = 0--Create ObjectEXECUTE @Error_No = sp_OACreate 'Microsoft.XMLHTTP', @XMLDoc OUTIF @Error_No != 0BEGIN EXEC sp_OAGetErrorInfo @XMLDoc, @src OUT, @desc OUT PRINT 'Problem Opening Method OPEN' PRINT 'Error Message: ' + CAST(@desc AS VARCHAR) PRINT 'Error No: ' + CAST(@Error_No AS VARCHAR) PRINT 'Error Source: ' + CAST(@src AS VARCHAR) RETURNEND--Open ObjectSET @URL = '"http:\\miranda\ebit.test.asp\test.asp"'EXECUTE @Error_No = sp_OAMethod @XMLDoc, 'OPEN',NULL,'"POST"',@URL, FALSEIF @Error_No != 0BEGIN EXEC sp_OAGetErrorInfo @XMLDoc, @src OUT, @desc OUT PRINT 'Problem Opening Method Request Header' PRINT 'Error Message: ' + CAST(@desc AS VARCHAR) PRINT 'Error No: ' + CAST(@Error_No AS VARCHAR) PRINT 'Error Source: ' + CAST(@src AS VARCHAR) RETURNEND--Send ObjectSET @XML = 'id=HELLO'EXECUTE @Error_No = sp_OAMethod @XMLDoc, 'SEND', @XMLIF @Error_No != 0BEGIN EXEC sp_OAGetErrorInfo @XMLDoc, @src OUT, @desc OUT PRINT 'Problem Opening Method Send' PRINT 'Error Message: ' + CAST(@desc AS VARCHAR) PRINT 'Error No: ' + CAST(@Error_No AS VARCHAR) PRINT 'Error Source: ' + CAST(@src AS VARCHAR) RETURNEND--Destroy ObjectEXECUTE @Error_No = sp_OADestroy @XMLDocIF @Error_No != 0BEGIN EXEC sp_OAGetErrorInfo @XMLDoc, @src OUT, @desc OUT PRINT 'Problem Opening Method Send' PRINT 'Error Message: ' + CAST(@desc AS VARCHAR) PRINT 'Error No: ' + CAST(@Error_No AS VARCHAR) PRINT 'Error Source: ' + CAST(@src AS VARCHAR) RETURNEND |
|
|
|
|
|
|