SQL Server Requires Chilkat v11.0.0+
SQL Server
Hungary NAV Manage Invoice Request
See more Hungary NAV Invoicing Examples
Demonstrates the manageInvoice request for the Hungarian NAV Online Invoicing System REST API v2.0.Chilkat SQL Server Downloads
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
DECLARE @sTmp0 nvarchar(4000)
DECLARE @success int
SELECT @success = 0
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
-- Build the following XML:
-- Use this online tool to generate code from sample XML:
-- Generate Code to Create XML
-- <?xml version="1.0" encoding="UTF-8"?>
-- <ManageInvoiceRequest xmlns="http://schemas.nav.gov.hu/OSA/2.0/api">
-- <header>
-- <requestId>RID181837288942</requestId>
-- <timestamp>2019-09-11T12:44:55.442Z</timestamp>
-- <requestVersion>2.0</requestVersion>
-- <headerVersion>1.0</headerVersion>
-- </header>
-- <user>
-- <login>lwilsmn0uqdxe6u</login>
-- <passwordHash>2F43840A882CFDB7DB0FEC07D419D030D864B47B6B541DC280EF81B937B7A176E33C052B0D26638CC18A7A2C08D8D311733078A774BF43F6CA57FE8CD74DC28E</passwordHash>
-- <taxNumber>11111111</taxNumber>
-- <requestSignature>E4D191A48EE8828A1E84C1F841A2B4E1699ECB49C4CDA1DC7A057765FD935872219644CC2B5A93B8A344404E4FD8ECA4902B5DBCF993E768DC558B0F0281E775</requestSignature>
-- </user>
-- <software>
-- <softwareId>123456789123456789</softwareId>
-- <softwareName>string</softwareName>
-- <softwareOperation>LOCAL_SOFTWARE</softwareOperation>
-- <softwareMainVersion>string</softwareMainVersion>
-- <softwareDevName>string</softwareDevName>
-- <softwareDevContact>string</softwareDevContact>
-- <softwareDevCountryCode>HU</softwareDevCountryCode>
-- <softwareDevTaxNumber>string</softwareDevTaxNumber>
-- </software>
-- <exchangeToken>b1aca173-d9e8-4561-9237-0511eed99eaa2P0ZHLXBRI2U</exchangeToken>
-- <invoiceOperations>
-- <compressedContent>false</compressedContent>
-- <invoiceOperation>
-- <index>1</index>
-- <invoiceOperation>CREATE</invoiceOperation>
-- <invoiceData>base64 contents of invoiceData1 XML file</invoiceData>
-- </invoiceOperation>
-- <invoiceOperation>
-- <index>2</index>
-- <invoiceOperation>CREATE</invoiceOperation>
-- <invoiceData>base64 contents of invoiceData2 XML file</invoiceData>
-- </invoiceOperation>
-- <invoiceOperation>
-- <index>3</index>
-- <invoiceOperation>CREATE</invoiceOperation>
-- <invoiceData>base64 contents of invoiceData3 XML file</invoiceData>
-- </invoiceOperation>
-- </invoiceOperations>
-- </ManageInvoiceRequest>
--
-- First load the invoiceData for the 3 XML invoice files we'll be sending.
DECLARE @bdInvoiceData1 int
EXEC @hr = sp_OACreate 'Chilkat.BinData', @bdInvoiceData1 OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @bdInvoiceData2 int
EXEC @hr = sp_OACreate 'Chilkat.BinData', @bdInvoiceData2 OUT
DECLARE @bdInvoiceData3 int
EXEC @hr = sp_OACreate 'Chilkat.BinData', @bdInvoiceData3 OUT
EXEC sp_OAMethod @bdInvoiceData1, 'LoadFile', @success OUT, 'qa_data/nav_invoicing/invoiceData1.xml'
EXEC sp_OAMethod @bdInvoiceData2, 'LoadFile', @success OUT, 'qa_data/nav_invoicing/invoiceData2.xml'
EXEC sp_OAMethod @bdInvoiceData3, 'LoadFile', @success OUT, 'qa_data/nav_invoicing/invoiceData3.xml'
IF @success = 0
BEGIN
PRINT 'Failed to load invoice data.'
EXEC @hr = sp_OADestroy @bdInvoiceData1
EXEC @hr = sp_OADestroy @bdInvoiceData2
EXEC @hr = sp_OADestroy @bdInvoiceData3
RETURN
END
DECLARE @crypt int
EXEC @hr = sp_OACreate 'Chilkat.Crypt2', @crypt OUT
DECLARE @dtNow int
EXEC @hr = sp_OACreate 'Chilkat.CkDateTime', @dtNow OUT
EXEC sp_OAMethod @dtNow, 'SetFromCurrentSystemTime', @success OUT
EXEC sp_OAMethod @dtNow, 'GetAsTimestamp', @sTmp0 OUT, 0
PRINT @sTmp0
-- The hash algorithm for the password is SHA512 (not SHA3-512).
EXEC sp_OASetProperty @crypt, 'HashAlgorithm', 'sha512'
EXEC sp_OASetProperty @crypt, 'EncodingMode', 'hex'
DECLARE @myPassword nvarchar(4000)
SELECT @myPassword = 'my-password'
DECLARE @passwordHash nvarchar(4000)
EXEC sp_OAMethod @crypt, 'HashStringENC', @passwordHash OUT, @myPassword
-- Generate a random request ID like "RID215118906689"
DECLARE @prng int
EXEC @hr = sp_OACreate 'Chilkat.Prng', @prng OUT
DECLARE @sbRequestId int
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbRequestId OUT
EXEC sp_OAMethod @sbRequestId, 'Append', @success OUT, 'RID'
EXEC sp_OAMethod @prng, 'RandomString', @sTmp0 OUT, 12, 1, 0, 0
EXEC sp_OAMethod @sbRequestId, 'Append', @success OUT, @sTmp0
EXEC sp_OAMethod @sbRequestId, 'GetAsString', @sTmp0 OUT
PRINT 'generated requestId = ' + @sTmp0
-- Calculate the requestSignature
EXEC sp_OASetProperty @crypt, 'HashAlgorithm', 'sha3-512'
DECLARE @signatureKey nvarchar(4000)
SELECT @signatureKey = 'ce-8f5e-215119fa7dd621DLMRHRLH2S'
DECLARE @sbFinalHashBase int
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbFinalHashBase OUT
-- First append the timestamp because we are going to remove certain chars/parts.
EXEC sp_OAMethod @dtNow, 'GetAsTimestamp', @sTmp0 OUT, 0
EXEC sp_OAMethod @sbFinalHashBase, 'Append', @success OUT, @sTmp0
DECLARE @numReplaced int
EXEC sp_OAMethod @sbFinalHashBase, 'Replace', @numReplaced OUT, 'Z', ''
EXEC sp_OAMethod @sbFinalHashBase, 'Replace', @numReplaced OUT, '-', ''
EXEC sp_OAMethod @sbFinalHashBase, 'Replace', @numReplaced OUT, ':', ''
EXEC sp_OAMethod @sbFinalHashBase, 'Replace', @numReplaced OUT, 'T', ''
-- Prepend the requestId and append the signatureKey
EXEC sp_OAMethod @sbRequestId, 'GetAsString', @sTmp0 OUT
EXEC sp_OAMethod @sbFinalHashBase, 'Prepend', @success OUT, @sTmp0
EXEC sp_OAMethod @sbFinalHashBase, 'Append', @success OUT, @signatureKey
-- Calculate each index hash and add it to the sbFinalHashBase
DECLARE @sbHashBase int
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbHashBase OUT
EXEC sp_OAMethod @sbHashBase, 'Append', @success OUT, 'CREATE'
EXEC sp_OAMethod @bdInvoiceData1, 'GetEncoded', @sTmp0 OUT, 'base64'
EXEC sp_OAMethod @sbHashBase, 'Append', @success OUT, @sTmp0
DECLARE @indexHash nvarchar(4000)
EXEC sp_OAMethod @sbHashBase, 'GetAsString', @sTmp0 OUT
EXEC sp_OAMethod @crypt, 'HashStringENC', @indexHash OUT, @sTmp0
EXEC sp_OAMethod @sbFinalHashBase, 'Append', @success OUT, @indexHash
EXEC sp_OAMethod @sbHashBase, 'Clear', NULL
EXEC sp_OAMethod @sbHashBase, 'Append', @success OUT, 'CREATE'
EXEC sp_OAMethod @bdInvoiceData2, 'GetEncoded', @sTmp0 OUT, 'base64'
EXEC sp_OAMethod @sbHashBase, 'Append', @success OUT, @sTmp0
EXEC sp_OAMethod @sbHashBase, 'GetAsString', @sTmp0 OUT
EXEC sp_OAMethod @crypt, 'HashStringENC', @indexHash OUT, @sTmp0
EXEC sp_OAMethod @sbFinalHashBase, 'Append', @success OUT, @indexHash
EXEC sp_OAMethod @sbHashBase, 'Clear', NULL
EXEC sp_OAMethod @sbHashBase, 'Append', @success OUT, 'CREATE'
EXEC sp_OAMethod @bdInvoiceData3, 'GetEncoded', @sTmp0 OUT, 'base64'
EXEC sp_OAMethod @sbHashBase, 'Append', @success OUT, @sTmp0
EXEC sp_OAMethod @sbHashBase, 'GetAsString', @sTmp0 OUT
EXEC sp_OAMethod @crypt, 'HashStringENC', @indexHash OUT, @sTmp0
EXEC sp_OAMethod @sbFinalHashBase, 'Append', @success OUT, @indexHash
-- Get our request signature (using sha3-512 because our HashAlgorithm was set to "sha3-512" up above...)
DECLARE @requestSignature nvarchar(4000)
EXEC sp_OAMethod @sbFinalHashBase, 'GetAsString', @sTmp0 OUT
EXEC sp_OAMethod @crypt, 'HashStringENC', @requestSignature OUT, @sTmp0
-- Load our recently obtained exchange token.
-- See Hungary NAV Invoicing Token Exchange Sample Code
DECLARE @xmlExchangeToken int
EXEC @hr = sp_OACreate 'Chilkat.Xml', @xmlExchangeToken OUT
EXEC sp_OAMethod @xmlExchangeToken, 'LoadXmlFile', @success OUT, 'qa_data/tokens/nav_exchange_token.xml'
IF @success = 0
BEGIN
EXEC sp_OAGetProperty @xmlExchangeToken, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @bdInvoiceData1
EXEC @hr = sp_OADestroy @bdInvoiceData2
EXEC @hr = sp_OADestroy @bdInvoiceData3
EXEC @hr = sp_OADestroy @crypt
EXEC @hr = sp_OADestroy @dtNow
EXEC @hr = sp_OADestroy @prng
EXEC @hr = sp_OADestroy @sbRequestId
EXEC @hr = sp_OADestroy @sbFinalHashBase
EXEC @hr = sp_OADestroy @sbHashBase
EXEC @hr = sp_OADestroy @xmlExchangeToken
RETURN
END
-- Get the base64 encoded/encrypted exchange token.
-- IMPORTANT: Make sure to use the exchange token before it expires.
-- If it expired, then get a new one..
DECLARE @encodedEncryptedExchangeToken nvarchar(4000)
EXEC sp_OAMethod @xmlExchangeToken, 'GetChildContent', @encodedEncryptedExchangeToken OUT, 'encodedExchangeToken'
-- Decode to binary.
DECLARE @bdExchangeToken int
EXEC @hr = sp_OACreate 'Chilkat.BinData', @bdExchangeToken OUT
EXEC sp_OAMethod @bdExchangeToken, 'AppendEncoded', @success OUT, @encodedEncryptedExchangeToken, 'base64'
-- Decrypt using your 16-digit replacement key:
EXEC sp_OASetProperty @crypt, 'CryptAlgorithm', 'aes'
EXEC sp_OASetProperty @crypt, 'CipherMode', 'ecb'
EXEC sp_OASetProperty @crypt, 'KeyLength', 128
EXEC sp_OASetProperty @crypt, 'EncodingMode', 'base64'
-- Pass your 16-digit replacement key here:
EXEC sp_OAMethod @crypt, 'SetEncodedKey', NULL, '99952BBAAAAA8XYZ', 'ascii'
EXEC sp_OAMethod @crypt, 'DecryptBd', @success OUT, @bdExchangeToken
DECLARE @exchangeToken nvarchar(4000)
EXEC sp_OAMethod @bdExchangeToken, 'GetString', @exchangeToken OUT, 'utf-8'
PRINT 'exchange token = ' + @exchangeToken
-- Now build the XML..
DECLARE @xml int
EXEC @hr = sp_OACreate 'Chilkat.Xml', @xml OUT
EXEC sp_OASetProperty @xml, 'Tag', 'ManageInvoiceRequest'
EXEC sp_OAMethod @xml, 'AddAttribute', @success OUT, 'xmlns', 'http://schemas.nav.gov.hu/OSA/2.0/api'
EXEC sp_OAMethod @sbRequestId, 'GetAsString', @sTmp0 OUT
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'header|requestId', @sTmp0
EXEC sp_OAMethod @dtNow, 'GetAsTimestamp', @sTmp0 OUT, 0
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'header|timestamp', @sTmp0
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'header|requestVersion', '2.0'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'header|headerVersion', '1.0'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'user|login', 'lwilsmn0uqdxe6u'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'user|passwordHash', @passwordHash
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'user|taxNumber', '11111111'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'user|requestSignature', @requestSignature
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'software|softwareId', '123456789123456789'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'software|softwareName', 'string'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'software|softwareOperation', 'LOCAL_SOFTWARE'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'software|softwareMainVersion', 'string'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'software|softwareDevName', 'string'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'software|softwareDevContact', 'string'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'software|softwareDevCountryCode', 'HU'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'software|softwareDevTaxNumber', 'string'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'exchangeToken', @exchangeToken
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'invoiceOperations|compressedContent', 'false'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'invoiceOperations|invoiceOperation|index', '1'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'invoiceOperations|invoiceOperation|invoiceOperation', 'CREATE'
EXEC sp_OAMethod @bdInvoiceData1, 'GetEncoded', @sTmp0 OUT, 'base64'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'invoiceOperations|invoiceOperation|invoiceData', @sTmp0
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'invoiceOperations|invoiceOperation[1]|index', '2'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'invoiceOperations|invoiceOperation[1]|invoiceOperation', 'CREATE'
EXEC sp_OAMethod @bdInvoiceData2, 'GetEncoded', @sTmp0 OUT, 'base64'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'invoiceOperations|invoiceOperation[1]|invoiceData', @sTmp0
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'invoiceOperations|invoiceOperation[2]|index', '3'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'invoiceOperations|invoiceOperation[2]|invoiceOperation', 'CREATE'
EXEC sp_OAMethod @bdInvoiceData3, 'GetEncoded', @sTmp0 OUT, 'base64'
EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'invoiceOperations|invoiceOperation[2]|invoiceData', @sTmp0
-- POST the XML to https://api-test.onlineszamla.nav.gov.hu/invoiceService/v2/manageInvoice
DECLARE @http int
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
EXEC sp_OASetProperty @http, 'Accept', 'application/xml'
DECLARE @endpoint nvarchar(4000)
SELECT @endpoint = 'https://api-test.onlineszamla.nav.gov.hu/invoiceService/v2/manageInvoice'
DECLARE @resp int
EXEC @hr = sp_OACreate 'Chilkat.HttpResponse', @resp OUT
EXEC sp_OAMethod @xml, 'GetXml', @sTmp0 OUT
EXEC sp_OAMethod @http, 'HttpStr', @success OUT, 'POST', @endpoint, @sTmp0, 'utf-8', 'application/xml', @resp
IF @success = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @bdInvoiceData1
EXEC @hr = sp_OADestroy @bdInvoiceData2
EXEC @hr = sp_OADestroy @bdInvoiceData3
EXEC @hr = sp_OADestroy @crypt
EXEC @hr = sp_OADestroy @dtNow
EXEC @hr = sp_OADestroy @prng
EXEC @hr = sp_OADestroy @sbRequestId
EXEC @hr = sp_OADestroy @sbFinalHashBase
EXEC @hr = sp_OADestroy @sbHashBase
EXEC @hr = sp_OADestroy @xmlExchangeToken
EXEC @hr = sp_OADestroy @bdExchangeToken
EXEC @hr = sp_OADestroy @xml
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @resp
RETURN
END
EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
PRINT 'Response status code = ' + @iTmp0
DECLARE @respXml int
EXEC @hr = sp_OACreate 'Chilkat.Xml', @respXml OUT
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
EXEC sp_OAMethod @respXml, 'LoadXml', @success OUT, @sTmp0
PRINT 'Response body:'
EXEC sp_OAMethod @respXml, 'GetXml', @sTmp0 OUT
PRINT @sTmp0
-- The result looks like this:
-- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-- <ManageInvoiceResponse xmlns="http://schemas.nav.gov.hu/OSA/2.0/api" xmlns:ns2="http://schemas.nav.gov.hu/OSA/2.0/data">
-- <header>
-- <requestId>RID871830318143</requestId>
-- <timestamp>2020-03-25T15:51:25Z</timestamp>
-- <requestVersion>2.0</requestVersion>
-- <headerVersion>1.0</headerVersion>
-- </header>
-- <result>
-- <funcCode>OK</funcCode>
-- </result>
-- <software>
-- <softwareId>123456789123456789</softwareId>
-- <softwareName>string</softwareName>
-- <softwareOperation>LOCAL_SOFTWARE</softwareOperation>
-- <softwareMainVersion>string</softwareMainVersion>
-- <softwareDevName>string</softwareDevName>
-- <softwareDevContact>string</softwareDevContact>
-- <softwareDevCountryCode>HU</softwareDevCountryCode>
-- <softwareDevTaxNumber>string</softwareDevTaxNumber>
-- </software>
-- <transactionId>2WT9GFSKFUU1V4XP</transactionId>
-- </ManageInvoiceResponse>
-- Use this online tool to generate parsing code from sample XML:
-- Generate Parsing Code from XML
DECLARE @ManageInvoiceResponse_xmlns nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetAttrValue', @ManageInvoiceResponse_xmlns OUT, 'xmlns'
DECLARE @ManageInvoiceResponse_xmlns_ns2 nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetAttrValue', @ManageInvoiceResponse_xmlns_ns2 OUT, 'xmlns:ns2'
DECLARE @requestId nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @requestId OUT, 'header|requestId'
DECLARE @timestamp nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @timestamp OUT, 'header|timestamp'
DECLARE @requestVersion nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @requestVersion OUT, 'header|requestVersion'
DECLARE @headerVersion nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @headerVersion OUT, 'header|headerVersion'
DECLARE @funcCode nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @funcCode OUT, 'result|funcCode'
DECLARE @softwareId nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @softwareId OUT, 'software|softwareId'
DECLARE @softwareName nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @softwareName OUT, 'software|softwareName'
DECLARE @softwareOperation nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @softwareOperation OUT, 'software|softwareOperation'
DECLARE @softwareMainVersion nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @softwareMainVersion OUT, 'software|softwareMainVersion'
DECLARE @softwareDevName nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @softwareDevName OUT, 'software|softwareDevName'
DECLARE @softwareDevContact nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @softwareDevContact OUT, 'software|softwareDevContact'
DECLARE @softwareDevCountryCode nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @softwareDevCountryCode OUT, 'software|softwareDevCountryCode'
DECLARE @softwareDevTaxNumber nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @softwareDevTaxNumber OUT, 'software|softwareDevTaxNumber'
DECLARE @transactionId nvarchar(4000)
EXEC sp_OAMethod @respXml, 'GetChildContent', @transactionId OUT, 'transactionId'
EXEC @hr = sp_OADestroy @bdInvoiceData1
EXEC @hr = sp_OADestroy @bdInvoiceData2
EXEC @hr = sp_OADestroy @bdInvoiceData3
EXEC @hr = sp_OADestroy @crypt
EXEC @hr = sp_OADestroy @dtNow
EXEC @hr = sp_OADestroy @prng
EXEC @hr = sp_OADestroy @sbRequestId
EXEC @hr = sp_OADestroy @sbFinalHashBase
EXEC @hr = sp_OADestroy @sbHashBase
EXEC @hr = sp_OADestroy @xmlExchangeToken
EXEC @hr = sp_OADestroy @bdExchangeToken
EXEC @hr = sp_OADestroy @xml
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @respXml
END
GO