Partilhar via


PROPID_M_SOAP_ENVELOPE

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

(Read-only, introduced in MSMQ 3.0.) The PROPID_M_SOAP_ENVELOPE property provides the SOAP envelope (not including binary attachments) of an SRMP message.

Property ID

PROPID_M_SOAP_ENVELOPE

Type Indicator

VT_LPWSTR

MQPROPVARIANT Field

pwszVal

Property Value

A string of Unicode characters containing the SOAP envelope from the message.

Remarks

The PROPID_M_SOAP_ENVELOPE property is a read-only property that is only used when reading SRMP messages. When an SRMP message is sent, the sending queue manager attaches the SOAP envelope, along with any SOAP attachments, to the message. The SOAP envelope consists of a body and a header.

To retrieve the SOAP envelope of an SRMP message, specify PROPID_M_SOAP_ENVELOPE_LENand PROPID_M_SOAP_ENVELOPE 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_SOAP_ENVELOPE_LEN to reallocate the SOAP envelope buffer and call the applicable function again.

After the receiving application retrieves this property, it can parse it to obtain specific SOAP body and header elements.

To retrieve the entire contents of an SRMP message in the form of an array of bytes, including both the SOAP envelope and the SOAP attachments associated with it, use the PROPID_M_COMPOUND_MESSAGE property.

Equivalent COM Property

With COM components, the equivalent property is MSMQMessage.SoapEnvelope.

Example Code

The following code fragment shows how PROPID_M_SOAP_ENVELOPE is specified in arrays that can be used to initialize an MQMSGPROPS structure for retrieving the SOAP envelope (note that the length of the SOAP envelope must be retrieved with the SOAP envelope).

ULONG ulSOAPEnvelopeBufferLength = 1024;  
WCHAR * wszSOAPEnvelopeBuffer = NULL;  
wszSOAPEnvelopeBuffer = (WCHAR*)malloc(ulSOAPEnvelopeBufferLength*sizeof(WCHAR));  
if (wszSOAPEnvelopeBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszSOAPEnvelopeBuffer, 0, ulSOAPEnvelopeBufferLength*sizeof(WCHAR));  
aMsgPropID[i] = PROPID_M_SOAP_ENVELOPE_LEN;      // Property ID  
aMsgPropVar[i].vt = VT_UI4;                      // Type indicator  
aMsgPropVar[i].ulVal = ulSOAPEnvelopeBufferLength;  
i++;  
  
aMsgPropID[i] = PROPID_M_SOAP_ENVELOPE;          // Property ID  
aMsgPropVar[i].vt = VT_LPWSTR;                   // Type indicator  
aMsgPropVar[i].pwszVal = wszSOAPEnvelopeBuffer;  // Application-defined buffer  
i++;  
  
// Reallocate memory for the SOAP envelope buffer if necessary.  
wszSOAPEnvelopeBuffer = (WCHAR*)realloc(wszSOAPEnvelopeBuffer, aMsgPropVar[1].ulVal*sizeof(WCHAR));  
if (wszSOAPEnvelopeBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszSOAPEnvelopeBuffer, 0, aMsgPropVar[1].ulVal*sizeof(WCHAR));  
aMsgPropVar[0].pwszVal = wszSOAPEnvelopeBuffer;  // Pointer to the new buffer  

See Also

Message Properties
MQMSGPROPS
MSMQMessage.SoapEnvelope
PROPID_M_COMPOUND_MESSAGE
PROPID_M_SOAP_ENVELOPE_LEN