Implement an Integration to Send an Incoming Message with a Base64-Encoded String to an External REST API that Accepts a Multipart Attachment

In the inbound payload, the content element is a Base64–encoded string. This can be sent as an attachment in an outbound request.

The Base64 string can be converted into a reference using XSL function decodeBase64ToReference. The reference can be assigned to an attachmentReference element as described in this section.

Since the inbound request is not multipart, but the outbound must be multipart, you must set some multipart-specific properties in the mapper for the outbound direction.

In the mapper, the contentType element is set to image/png, partName is set to picture.png, and fileInputHtmlFieldName is set to image

In this scenario, the assumption is that the target system is configured to read from a body part having name="image" in its content disposition. This is done through the fileInputHtmlFieldName element.

Note:

If the target is multipart/mixed or multipart/form-data using a JSON/XML payload, the schema of the target also has the schema from JSON/XML. The approach for constructing the outbound request payload is the same.

Description of rest_adapter_mapper2.png follows
Description of the illustration rest_adapter_mapper2.png


Description of rest_adapter_ex_bldr.png follows
Description of the illustration rest_adapter_ex_bldr.png