Expand Minimize

PROPID_M_COMPOUND_MESSAGE

(Introduced in MSMQ 3.0.) The PROPID_M_COMPOUND_MESSAGE property provides the entire contents of an SRMP message, including both the SOAP envelope and the SOAP attachments associated with it.

Property ID

PROPID_M_COMPOUND_MESSAGE

Type Indicator

VT_VECTOR | VT_UI1

MQPROPVARIANT Field

caub

Property Value

An array of bytes that represents the entire contents of an SRMP message, including both the SOAP envelope and the SOAP attachments (MIME binary attachments) associated with it.

Remarks

The PROPID_M_COMPOUND_MESSAGE property is a read-only property that is used only when an application retrieves SRMP messages. When an SRMP message is sent, the sending queue manager attaches the SOAP attachments, along with the SOAP envelope, to the message.

This property can contain any number of SOAP attachments. It is the responsibility of the receiving application to parse the returned data and process the envelope and the individual attachments to retrieve individual elements. Any XML parser can be used for this purpose.

To retrieve the entire contents of an SRMP message, specify PROPID_M_COMPOUND_MESSAGE_SIZE and PROPID_M_COMPOUND_MESSAGE in the MQMSGPROPS structure. Then, call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned value.

If MQReceiveMessage or MQReceiveMessageByLookupId fails, returning an MQ_ERROR_BUFFER_OVERFLOW error, use the returned value of PROPID_M_COMPOUND_MESSAGE_SIZE to reallocate the message body buffer and call the applicable function again.

To retrieve the SOAP envelope, use the PROPID_M_SOAP_ENVELOPE property.

To retrieve the message body, which is sent as an attachment in an SRMP message, use the PROPID_M_BODY property.

Equivalent COM Property

With COM components, the equivalent property for retrieving the entire contents of an SRMP message is MSMQMessage.CompoundMessage.

Example Code

The following code fragment shows how PROPID_M_COMPOUND_MESSAGE is specified in arrays that can be used to initialize an MQMSGPROPS structure for retrieving the entire contents of an SRMP message, including both the SOAP envelope and the SOAP attachments associated with it (note that the size of the entire message must be retrieved with the attachments).

aMsgPropID[i] = PROPID_M_COMPOUND_MESSAGE_SIZE;     // Property ID
aMsgPropVar[i].vt = VT_UI4;                         // Type indicator
i++;

ULONG ulMsgBufferSize = 4096;
UCHAR * pucMsgBuffer = NULL;
pucMsgBuffer = (UCHAR *)malloc(ulMsgBufferSize);
if (pucMsgBuffer == NULL)
{
  return MQ_ERROR_INSUFFICIENT_RESOURCES;
}
memset(pucMsgBuffer, 0, ulMsgBufferSize);
aMsgPropID[i] = PROPID_M_COMPOUND_MESSAGE;          // Property ID
aMsgPropVar[i].vt = VT_VECTOR | VT_UI1;             // Type indicator
aMsgPropVar[i].caub.pElems = (UCHAR*)pucMsgBuffer;
aMsgPropVar[i].caub.cElems = ulMsgBufferSize;
i++;

// Reallocate memory for the message buffer if necessary.
ulMsgBufferSize = aMsgPropVar[0].ulVal*sizeof(UCHAR);
pucMsgBuffer = (UCHAR*)realloc(pucMsgBuffer, ulMsgBufferSize);
if (pucMsgBuffer == NULL)
{
  return MQ_ERROR_INSUFFICIENT_RESOURCES;
}
memset(pucMsgBuffer, 0, ulMsgBufferSize);
aMsgPropVar[1].caub.pElems = (UCHAR*)pucMsgBuffer;  // Pointer to the new buffer
aMsgPropVar[1].caub.cElems = ulMsgBufferSize;       // New buffer size

See Also

Show:
© 2014 Microsoft