Release 10.1A: OpenEdge Development:
Messaging and ESB

> ## MultiPartMessage example

> The following fragment creates a `MultiPartMessage`:

>     /* Create a multipart message */
>     RUN createMultipartMessage IN ptpsession (OUTPUT messageH).
>     /* Create a Sonic text message */
>     RUN createTextMessage IN ptpsession (OUTPUT messagePartH).
>     RUN setText IN messagePartH (cTextString).
>     /* Add part to multipart message */
>     RUN addMessagePart IN messageH (INPUT messagePartH, INPUT contentIDString).
>     /* Add a memptr part */
>     RUN addBytesPart IN messageH (INPUT memptr, INPUT contentTypeString,
>                                   INPUT contentIDString).
>     /* Add a text part */
>     RUN addTextPart IN messageH (INPUT memptr, INPUT msgTextString,
>                                  INPUT contentTypeString,
>                                  INPUT contentIDString).

> First, the fragment creates a `MultiPartMessage` just as it would create any other supported message type. The createMultipartMessage procedure returns a message handle, which supports methods for adding parts.

> Next, the fragment creates a text message and adds it to the `MultiPartMessage`. Each message part has two main identifiers: content type and content ID. Content type identifies the type of part, while content ID identifies a particular part. Since a Sonic text message already has a content type, when the text message is added, only the content ID must be specified.

> Finally, the fragment adds a bytes part, comprising an arbitrary set of bytes represented as a `MEMPTR`. Adding the bytes part resembles adding the text message except that the content type must also be specified.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095