Binary Content Type Support in Oracle Integration Rest Adapter Trigger
Introduction:
Oracle Integration Rest Adapter now supports application/octet-stream in the trigger request and response, with this new capability, it will be possible to invoke an integration using Binary content over REST. Similarly, it will be possible for an integration flow to return binary content in response to a request over REST. Before we do a deep dive on the feature let us start with understating what is application/octet-stream
About "application/octet-stream" MIME attachments:
A MIME attachment with the content type "application/octet-stream" is a binary file. Typically, it will be an application or a document that must be opened in an application, such as a spreadsheet or word processor. If the attachment has a filename extension associated with it, you may be able to tell what kind of file it is. A .exe extension, for example, indicates it is a Windows or DOS program (executable), while a file ending in .doc is probably meant to be opened in Microsoft Word.
No matter what kind of file it is, an application/octet-stream attachment is rarely viewable in an email or web client. If you are using a workstation-based client, such as Thunderbird or Outlook, the application should be able to extract and download the attachment automatically. After downloading an attachment through any of these methods, you must then open the attachment in the appropriate application to view its contents.
How is this leveraged in Oracle Integration Rest Adapter:
This feature allows client application to send/receive structured/unstructured content to be sent as raw data / stream of characters to and from Oracle Integration flow, The Customer can send files like PDF, CSV, and JPG to Oracle Integration for processing and Integration Flows can be modeled to send files like PDF, CSV, and JPG as response back to client applications
However there is no restriction on the content-type. We will not parse the request or the response and just write it as a byte stream along with the appropriate header
User has to select the binary option in the Rest Adapter trigger wizard in the request to consume a binary content file which is sent by the client application, similarly user has to select the binary option in the rest adapter invoke wizard in the response to produce a binary content to a client application.
Oracle Integration Rest Adapter Trigger configuration and Mapping:
Media Types Supported in the new feature:
Oracle Integration now has the capability to expose a rest endpoint which can consume and produce octet stream media types
following image shows the media types supported in Rest configuration wizard
Other Media Type selection:
If user wants to select another types that are not available in the drop down he can select the other media types in the drop down and he can provide the media type name as shown in the following screen.
Mapping Elements for Octet-Stream:
Once the Trigger and invoke is configured with binary using the Oracle Integration rest connection, the mapping activity comes with a single element (Stream Reference), this stream reference accepts a file without any schema because the request and response contains can consume any kind of data in any format.
Mapping is a "StreamReference" attribute which will take the binary content reference to process the binary data from and to the client application, the following image shows the mapping elements in both request and and response of a rest trigger.
The Oracle Integration exposed rest endpoint metadata of swagger and openapi type which consumes and produces a binary type can we used in any client(for example, a swagger editor or a postman client) and we can use this metadata to create a request.