title: How to pass SSL certificate to call secured web service in SQL Server 2008 R2
body: <p>I have an external web service secured by SSL certificate. I can call this web service in my C# application. Now I need to call it using SQL Server 2008 R2. I have used some code to call it like</p>
  
  <pre><code>declare @iobject integer
  declare @ihr integer
  declare @data nvarchar(4000)
  declare @smtpWebService varchar(200) 
  declare @retVal varchar(8000) 
  declare @src varchar(1000)
  declare @desc varchar(1000)
  
  exec @ihr = sp_oaCreate 'Msxml2.ServerXMLHTTP.3.0', @iobject OUTPUT 
  if (@ihr &lt;&gt; 0)
  begin 
        exec sp_displayoaerrorinfo @iobject, @ihr return
  end
  
  set @smtpWebService = 'https://xyzService.asmx/GetInformation'
  set @data = 'ID=50'
  
  exec @ihr = sp_OAMethod @iobject, 'Open', null, 'GET',@smtpWebService, 0
  exec @ihr = sp_OAMethod @iobject, 'setRequestHeader', null, 'Content-Type', 'application/x-www-form-urlencoded'
  exec @ihr = sp_OAMethod @iobject, 'send', null, @data 
  
  if @ihr &lt;&gt; 0
  begin
  exec sp_OAGetErrorInfo @iobject, @src OUT, @desc OUT
  select hr = convert(varbinary(4),@ihr), Source = @src, Description = @desc 
  
  print @src 
  print @desc
  end
  
  exec @ihr = sp_OAGetProperty @iObject, 'responseText', @retVal OUT
  print @retVal
  
  -- Destroy the object
  exec @ihr = sp_OADestroy @iobject
  </code></pre>
  
  <p>It gives message </p>
  
  <blockquote>
    <p>A certificate is required to complete client authentication </p>
  </blockquote>
  
  <p>Can anyone please suggest how I can pass a SSL certificate from SQL Server?</p>
  
  <p>Note: the certificate is installed on my current user account and local machine.</p>