The virtual file system (VFS) enables you to store files and internally use references to these files in the message payload. You can also map the VFS file's content to a string element.
The REST Adapter supports the multipart attachment and application/octet-stream features. The attachment is stored in a staging area and an
attachmentReference(string key) is generated. The
attachmentReferencekey is sent as part of the message payload and later fetches the attachment instance from the staging area.
The FTP Adapter uses
fileReferencefor reading/writing a file without a schema.
fileReferenceis also a reference to a file stored in the VFS.
Map the content of a staged file attachment to a string element by converting the content to a base64 string.
Store the base64 string as an attachment and generate a VFS reference.
Two XPath functions are provided to perform these tasks. These functions work with any adapter.
encodeReferenceToBase64(String reference): Accepts the VFS’s file reference as input and returns the base64–encoded content of the file as the return value. This function has a file size limit of 10 MB. If a file is larger than 10 MB, an exception message of
Maximum file size supported is 10 MBis displayed.
decodeBase64ToReference(String base64String): Accepts the base64–encoded content as input, decodes it, stores the base64–decoded value in a file in the VFS, and returns the reference to this file. There is no size limit because the content is already in memory.
Expression Builder, when configuring the following actions in an orchestrated integration:
Mapper (visible after selecting Mapping Components - Functions - Advanced):
Description of the illustration encode_decode.png
The attachments are not restricted to document file types. For example, an image can be base64–encoded and later decoded back to the original file.
When an attachment is stored in the VFS, a key is generated to retrieve the attachment at a later time. The key is shown in the mapper as
attachmentReference/fileReference/streamReference. This key is propagated within Oracle Integration Cloud Service as part of the payload. The attachment is claimed only when needed. The names
streamReference are based on the adapter type. For example, in the REST Adapter,
streamReference is used. The data type of the reference is a string.
With a multipart feature, the HTTP request payload has multiple parts separated by boundaries. Each of the individual parts are considered an attachment. For raw bytes,
streamReference is used. FTP uses
Sometimes the endpoints accept only base64–encoded values. In these cases, the reference is passed as input to
encodeReferenceToBase64 to get the base64–encoded content of the file. Again, the base64–encoded value can be passed as input to
decodeBase64ToReference to get the reference (location) to a file that contains the decoded content.