Tuesday, July 29, 2025

OIC - Handling Mixed File Inputs in Oracle Integration (OIC): Smart Zip Check and Transfer to SFTP

Use Case

In real-world integrations, especially with ERP or external systems, files received from source applications may vary in format — some may already be zipped while others may not. To ensure consistency and avoid errors during downstream processing or transfer to systems like SFTP, we need a way to check if a file is zipped and handle it accordingly.

This use case demonstrates an Oracle Integration Cloud (OIC) integration that intelligently detects whether an incoming file is a zipped archive. If the file is already zipped, it is forwarded directly to the target SFTP server. If it's not zipped, the integration compresses it and then transfers it to the target location.


Solution Steps

  1. Scope: CheckZipFile

    • A scope that encapsulates the logic for file evaluation and error handling.
  2. Main Flow:

    • Stage File – UnzipFile:
      Tries to unzip the incoming file.
      • If successful, it means the file was zipped. No further compression is needed.
      • If it fails (i.e., the file isn't a zip), an exception is thrown.
  3. Fault Handler: Default Handler

    • Stage File – ZipFile:
      This step is triggered only when UnzipFile fails, meaning the file wasn't zipped. The step compresses the incoming file.
    • Stitch – AssignFileRef:
      Assigns or updates the file reference to point to the newly zipped version for further processing or transfer.
  4. Downstream Processing 

    • The processed (either original zipped or newly zipped) file is sent to the target SFTP or other endpoints.

Benefits

  • Flexibility: Handles both zipped and non-zipped files without requiring format enforcement at the source.
  • Error Handling: Robust fallback logic ensures no failure in case of unexpected file formats.
  • Automation Ready: Ideal for file-based B2B integrations or scheduled ERP exports.


No comments:

Post a Comment

Featured Post

OIC - OIC Utility to Reprocess Failed Real-Time Integration JSON Payloads

📌 Use Case In real-time OIC integrations, JSON payloads are exchanged with external systems via REST APIs. When such integrations fail (du...