Multipart request messages
- Last Updated: February 6, 2024
- 4 minute read
- OpenEdge
- Version 12.2
- Documentation
A multipart message contains a body with many component body parts. Each body part has a content type, a body, and headers (which are optional). Multipart messages are typically used in order to avoid multiple request/responses, or to provide different representations of the same data.
The OpenEdge.Net library supports the
transmission of multipart messages through the OpenEdge.Net.MultipartEntity and the OpenEdge.Net.MessagePart classes.
To create a request body consisting of multiple parts, create multiple
MessagePart objects, add them to a MultipartEntity object, and pass the MultipartEntity as the request body.
Each
MessagePart can have two parameters—the content
type (string) and an object. The object can be string/longchar, a string or JSON object,
or a binary file (for example, a ByteBucket).Note: When a binary
file is present as part of a multipart request, the entire data payload will be
base64 encoded for transfer. If all parts of the message are
strings then they will remain as such and will not be encoded during the tranmission
and subsequent reading of the request.
|
Note: The
test-image.jpg referenced in the third
message part of the sample code can be any *.jpeg image located in
the PROPATH for the code when executed.
|