Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(DataFlex) Aruba Fatturazione Elettronica Get Zip by Filename

Returns 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

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

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.