Progress
External Program
Interfaces


Multipart Message Example

The following fragment creates a multipart message:

/* 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 multipart message just as it would create any other supported message type. The createMultipartMessage method returns a message handle, which supports methods for adding parts.

Next, the fragment creates a text message and adds it to the multipart message. 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 © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095