Servizio per l’interrogazione dello stato di una richiesta
curl -X POST https://demows.fatturazioneelettronica.aruba.it/services/ClientRequest/GetTransmissionInfoRequest?username=Utente&password=Password \
-H 'Accept: application/json' \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{
"userName" : "Utente",
"password" : "Password",
"requestID" : "Z68Q7T4KZ3"
}'
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
DECLARE @sTmp0 nvarchar(4000)
DECLARE @rest int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rest', @rest OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- URL: https://demows.fatturazioneelettronica.aruba.it/services/ClientRequest/GetTransmissionInfoRequest?username=Utente&password=Password
DECLARE @bTls int
SELECT @bTls = 1
DECLARE @port int
SELECT @port = 443
DECLARE @bAutoReconnect int
SELECT @bAutoReconnect = 1
EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'demows.fatturazioneelettronica.aruba.it', @port, @bTls, @bAutoReconnect
IF @success <> 1
BEGIN
EXEC sp_OAGetProperty @rest, 'ConnectFailReason', @iTmp0 OUT
PRINT 'ConnectFailReason: ' + @iTmp0
EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
RETURN
END
-- See the Online Tool for Generating JSON Creation Code
DECLARE @json int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @json OUT
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'userName', 'Utente'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'password', 'Password'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'requestID', 'Z68Q7T4KZ3'
EXEC sp_OAMethod @rest, 'AddHeader', @success OUT, 'Content-Type', 'application/json;charset=UTF-8'
EXEC sp_OAMethod @rest, 'AddHeader', @success OUT, 'Accept', 'application/json'
DECLARE @sbRequestBody int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbRequestBody OUT
EXEC sp_OAMethod @json, 'EmitSb', @success OUT, @sbRequestBody
DECLARE @sbResponseBody int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @rest, 'FullRequestSb', @success OUT, 'POST', '/services/ClientRequest/GetTransmissionInfoRequest?username=Utente&password=Password', @sbRequestBody, @sbResponseBody
IF @success <> 1
BEGIN
EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @json
EXEC @hr = sp_OADestroy @sbRequestBody
EXEC @hr = sp_OADestroy @sbResponseBody
RETURN
END
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @respStatusCode OUT
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Status Code = ' + @respStatusCode
PRINT 'Response Header:'
EXEC sp_OAGetProperty @rest, 'ResponseHeader', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Response Body:'
EXEC sp_OAMethod @sbResponseBody, 'GetAsString', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @json
EXEC @hr = sp_OADestroy @sbRequestBody
EXEC @hr = sp_OADestroy @sbResponseBody
RETURN
END
DECLARE @jsonResponse int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @jsonResponse OUT
EXEC sp_OAMethod @jsonResponse, 'LoadSb', @success OUT, @sbResponseBody
-- See the Online Tool for Generating JSON Parse Code
DECLARE @result nvarchar(4000)
DECLARE @error nvarchar(4000)
DECLARE @notifyResult nvarchar(4000)
DECLARE @elaboratedResult nvarchar(4000)
DECLARE @receiptTimestamp nvarchar(4000)
DECLARE @fileID nvarchar(4000)
DECLARE @fileName nvarchar(4000)
EXEC sp_OAMethod @jsonResponse, 'StringOf', @result OUT, 'result'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @error OUT, 'error'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @notifyResult OUT, 'notifyResult'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @elaboratedResult OUT, 'elaboratedResult'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @receiptTimestamp OUT, 'receiptTimestamp'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @fileID OUT, 'fileID'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @fileName OUT, 'fileName'
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @json
EXEC @hr = sp_OADestroy @sbRequestBody
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jsonResponse
END
GO
{
"result": "SF01",
"error": "In elaborazione",
"notifyResult": "",
"elaboratedResult": "",
"receiptTimestamp": "2017-04-18 18:30:30",
"fileID": "0610103456",
"fileName": "ITAFUMBWJKFGU_LI_0001.xml"
}