Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Aruba Fatturazione Elettronica Get Zip by FilenameReturns an invoice with all of its notifications in Zip format (e.g. IT01879020517_abcde.xml.p7m). For more information, see https://fatturazioneelettronica.aruba.it/apidoc/docs_EN.html#_getzipbyfilename
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Boolean iSuccess Variant vBdZip Handle hoBdZip Integer iRespStatusCode Handle hoZip Integer iNumUnzipped Variant vEntry Handle hoEntry Variant vBdP7m Handle hoBdP7m Handle hoCrypt String sTemp1 Boolean bTemp1 // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End // Implements the following CURL command: // curl -X GET https://ws.fatturazioneelettronica.aruba.it/services/invoice/in/getZipByFilename?filename=IT01879020517_jtlk1.xml.p7m \ // -H "Accept: application/json" \ // -H "Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=" // Use the following online tool to generate HTTP code from a CURL command // Convert a cURL Command to HTTP Source Code // Adds the "Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=" header. Set ComAuthToken Of hoHttp To "NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=" Send ComSetRequestHeader To hoHttp "Accept" "application/json" Get Create (RefClass(cComChilkatBinData)) To hoBdZip If (Not(IsComObjectCreated(hoBdZip))) Begin Send CreateComObject of hoBdZip End Get pvComObject of hoBdZip to vBdZip Get ComQuickGetBd Of hoHttp "https://ws.fatturazioneelettronica.aruba.it/services/invoice/in/getZipByFilename?filename=IT01879020517_jtlk1.xml.p7m" vBdZip To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComLastStatus Of hoHttp To iRespStatusCode Showln "response status code = " iRespStatusCode If (iRespStatusCode <> 200) Begin // If it failed, the response body will not contain the .zip file data. // It will likely contain an error message. Get ComGetString Of hoBdZip "utf-8" To sTemp1 Showln sTemp1 Showln "Failed." Procedure_Return End // Open the zip and extract the .p7m Get Create (RefClass(cComChilkatZip)) To hoZip If (Not(IsComObjectCreated(hoZip))) Begin Send CreateComObject of hoZip End Get pvComObject of hoBdZip to vBdZip Get ComOpenBd Of hoZip vBdZip To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoZip To sTemp1 Showln sTemp1 Procedure_Return End // If desired, we can unzip to the filesystem.. Get ComUnzip Of hoZip "c:/mySignedInvoices" To iNumUnzipped If (iNumUnzipped < 0) Begin Get ComLastErrorText Of hoZip To sTemp1 Showln sTemp1 Procedure_Return End // Alternatively, we can unzip into memory.. Get ComGetEntryByIndex Of hoZip 0 To vEntry If (IsComObject(vEntry)) Begin Get Create (RefClass(cComChilkatZipEntry)) To hoEntry Set pvComObject Of hoEntry To vEntry End Get ComLastMethodSuccess Of hoZip To bTemp1 If (bTemp1 = False) Begin Get ComLastErrorText Of hoZip To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatBinData)) To hoBdP7m If (Not(IsComObjectCreated(hoBdP7m))) Begin Send CreateComObject of hoBdP7m End Get pvComObject of hoBdP7m to vBdP7m Get ComUnzipToBd Of hoEntry vBdP7m To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoEntry To sTemp1 Showln sTemp1 Procedure_Return End Send Destroy of hoEntry // Verify the signature and extract the XML from the p7m // If the signature verification is successful, the contents of bdP7m are unwrapped and what // remains is the original signed document.. Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt If (Not(IsComObjectCreated(hoCrypt))) Begin Send CreateComObject of hoCrypt End Get pvComObject of hoBdP7m to vBdP7m Get ComOpaqueVerifyBd Of hoCrypt vBdP7m To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoCrypt To sTemp1 Showln sTemp1 Procedure_Return End Showln "The signature was verified." // The bdp7m now contains the XML that was originally signed. Showln "Original XML:" Get ComGetString Of hoBdP7m "utf-8" To sTemp1 Showln sTemp1 End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.