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 |
shobhaaradhya
Starting Member
37 Posts |
Posted - 2014-09-19 : 01:11:11
|
Hi, I am trying to set the basic authentication for one of the test site.My code is below declare @URL varchar(512) declare @post varchar(4000) declare @WebLogin varchar(128) declare @WebPassword varchar(128) declare @http intdeclare @Doing varchar(512)declare @status intdeclare @desc varchar(512)declare @src varchar(255)declare @chrXML XMLSET @chrXML ='<?xml version="1.0" encoding="utf-8"?><request method="client.list"></request>'set @URL ='http://httpbin.org/basic-auth/user1/user1' set @WebLogin = 'user1' set @WebPassword = 'user1' exec @status = master.dbo.sp_OACreate 'MSXML2.XMLHTTP', @http output IF @status < 0 BEGIN EXEC @status = sp_OAGetErrorInfo @httpEND set @Doing = 'Open("POST, null" , "' + @URL + '", 0 )' exec @status = sp_OAMethod @http, @DoingIF @status < 0 BEGIN EXEC @status = sp_OAGetErrorInfo @httpENDEXEC sp_OAMethod @http, 'setRequestHeader', NULL, 'Content-Type', 'text/xml'EXEC sp_OAMethod @http, 'setRequestHeader', NULL, 'Content-Length'set @Doing = 'SetCredentials("' + @WebLogin + '","' + @WebPassword + '",0)' exec @status = sp_OAMethod @http, @Doingprint @statusIF @status < 0 BEGIN EXEC @status = sp_OAGetErrorInfo @httpENDWhen the code setcredentials is executed it gives error -2147352570Error Source Description HelpFile HelpID---------- ------------------------- -------------- -------- -----------0x80020006 ODSOLE Extended Procedure Unknown name. NULL 0Can anyone help me where I am going wrong and how to resolve this.I am using sql server 2005.Thanks in advance,Pavan |
|
|
|
|
|
|