IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation

 View Only
  • 1.  Using pub.client:http for downloading files

    Posted yesterday

    Hi Webmethods expert,

    I'm trying to understand how to use 'pub.client:http' for downloading files, but I can't find specific information in the available IBM documentation. 

    Can anyone guide me or share their experience on how this can be accomplished using 'pub.client:http'?

    Basically we want to download some file from our Trading partners.

    Instead of providing us the SFTP server, they just give us the URL to download it.

    If we tried the URL in the browser, it can download the file instantly. 

    Just wondering how to accomplish this using Webmethods Designer.

    Your insights would be greatly appreciated.

    Thank you.

    Fanny T



  • 2.  RE: Using pub.client:http for downloading files

    Posted yesterday

    Hi Fanny - great question.

    You can absolutely download files via pub.client:http from IBM webMethods Integration Server
    (and the same approach applies when your service runs on Edge Runtime in a DADA SaaS setup).
    Below is a practical, step‑by‑step guide:


    When file is small/medium (fits into memory):

    1. pub.client:http

      • method = "get"
      • url = (the full download URL you tested in the browser)
      • headers (optional) = if your partner requires them (e.g., Authorization)
      • followRedirects = true (good for "signed" or pre-signed URLs that redirect)
      • loadAs = "bytes" (returns the body as bytes)

      Outputs of interest:

      • status (e.g., 200)
      • responseStatus (e.g., 200 OK)
      • responseHeaders (for filename hints in Content-Disposition)
      • body (the file content as bytes)
    2. (Optional) Determine a filename from headers

      • Parse responseHeaders/Content-Disposition if present (e.g., attachment; filename="data_20260305.csv"). If absent, fallback to a configured or URL‑derived name.
    3. pub.file:bytesToFile

      • bytes = pipeline body
      • filename = e.g., /interfaces/inbound/partner1/data_20260305.csv
      • append = false

    That's it. You'll have the file on the IS/Edge host filesystem.

    Note: For large files, avoid loading the entire content into memory:

    1. pub.client:http

      • Same as above, but set loadAs = "stream".

      Outputs of interest:

      • responseStream (InputStream)
    2. Write stream to disk

      • Prefer pub.io:streamToFile if available in your version:
        • stream = responseStream
        • fileName = target path
        • overwrite = true
      • If pub.io:streamToFile is not present in your IS version, you have two common alternatives:
        • pub.io:streamToBytespub.file:bytesToFile (still loads in memory; OK for medium sizes).
        • Implement a tiny Java service to copy the stream to file in chunks (true streaming, minimal memory).

    (( AI generated summary and Examples ))



    ------------------------------
    Holm Steinland
    IBM
    Ehningen
    ------------------------------



  • 3.  RE: Using pub.client:http for downloading files

    Posted 22 hours ago

    Good response. But I don't think pub.io:streamToFile exists in any version. Perhaps you meant pub.file:streamToFile. Make sure to call pub.io:close on the stream after



    ------------------------------
    Dave Laycock
    ------------------------------



  • 4.  RE: Using pub.client:http for downloading files

    Posted 13 hours ago

    Hi Holm, thank you very much for the detail explanation.

    Really appreciate it.

    Definitely will try this. Hope others can have the benefit as well.

    Best Regards,
    Fanny T



    ------------------------------
    Fanny Tirtasari
    ------------------------------