Formatting a message with MIME, S/MIME, DIME, and multipart content
You can format a message by applying a MIME or DIME schema. HCL OneTest™ API supports the S/MIME standard for secure encryption, decryption, and signing of MIME data.
The MIME and DIME schemas
- Right-click the Text node of the message and click Schema.
- In the Schema Selector window, click or as the Schema Type.
- Select a root from the displayed options. A sample message is displayed with the schema applied.
- Click OK to return to the message.
- For multipart MIME nodes, you can add parts. Right-click the content
(multipart/*) node and click and select
one of the following part types:
- Binary
- Multipart
- Text
- For DIME messages, you can add records to the (Message) node.
Right-click the node and click and select one of the
following record types:
- Binary
- Text
Multiparts
Text content such as JSON can be pasted into the Multipart node and HCL OneTest™ API recognizes it and expands it as a tree.
To add content into a multipart node:
Binary Data
- Add Binary content such as file data by editing the ByteArray node. Right-click the node and select Open Field Value.
- Select the file to load in.
Form-Data
Form-Data messages are commonly used to send files over HTTP, and require additional header configuration.
To add the Form-Data file:
- Set the
multipart/form-data
.
node to - Add the message text part as previously described. Configure the headers to identify the content type and a name.
- Set the
application/pdf
to describe the data.
node to - Right-click the node and select .
- In the field editor, provide a name for the Content-Disposition node by
setting the value to
form-data; name="file"; filename="Readme.pdf"
- Edit the
ByteArray
and use the Open Field Value menu option to pull in the file data.
node. Change the type to
To add Form-Data inline:
- Set the
multipart/form-data
.
node to - Add message text as previously described. Configure the headers to identify the content type and a name.
- Right-click the node and select .
- In the field editor, provide a name for the Content-Disposition node by
setting the value to
form-data; name="body"
- Edit the An example message that contains two items of form data that is named
body
andfile
is shown:
node to include the inline data.
S/MIME properties
- In the Test Factory perspective message tree, double-click the message to open it in the message editor.
- Right-click the text (String) {MIME} or data(ByteArray) {MIME} node and then click Properties.
- On the S/MIME security settings dialog, you have four options:
- Encrypt
- Decrypt
- Sign
- Unsign
The Encrypt and Sign options can be selected together or separately.
The Decrypt and Unsign options are inbound options and can also be selected together or separately.
The Encrypt, Decrypt, Sign options require the name of a Keystore and a Certificate Alias from within that keystore. Outbound options (Encrypt and Sign) require an Algorithm. Decrypt and Sign options require a Password.
Note: If you apply the MIME schema to a message, you can also apply the S/MIME properties at the same time, through the Schema Selector window.
Content Transfer Encoding
The Content-Transfer-Encoding header is a MIME header that controls how the content must be encoded for transmission. HCL OneTest™ API chooses an encoding based on the content and the type of root node that the MIME message is built on. If the MIME message is built on a Text node, then it is assumed that the content is required to be 7-bit data and is encoded by using 7 bit, base64, or quoted-printable encoding. If the MIME message is built on a ByteArray node, then binary encoding is chosen, which is suitable for protocols without a 7-bit restriction such as HTTP and AS2.