共用方式為


PROPID_M_SOAP_HEADER

 

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

(Write-only, introduced in MSMQ 3.0.) The PROPID_M_SOAP_HEADER property specifies additional application-generated header elements for inclusion in the SOAP envelope of an SRMP message.

Property ID

PROPID_M_SOAP_HEADER

Type Indicator

VT_LPWSTR

MQPROPVARIANT Field

pwszVal

Property Value

A string of Unicode characters specifying well-formed XML header elements for inclusion in the SOAP envelope of the SRMP message.

Remarks

The PROPID_M_SOAP_HEADER property is a write-only property that is used only when an application sends SRMP messages. When an SRMP message is sent, the sending queue manager appends the string of additional SOAP header elements specified in this property to the end of the Message Queuing-generated SOAP header portion of the SOAP envelope in the message. It then attaches the SOAP envelope, and, when applicable, SOAP attachments to the message.

The string supplied to this property must contain only well-formed XML elements, because the SOAP header is used internally by Message Queuing. If anything introduced into this property is not well-formed XML, an MQ_ERROR_PROPERTY error will be returned when the message is sent.

To set additional application-generated SOAP header elements, specify PROPID_M_SOAP_HEADER in the MQMSGPROPS structure and call MQSendMessage.

To set application-generated SOAP body elements in the SOAP envelope, use the PROPID_M_SOAP_BODY property.

To retrieve the complete SOAP envelope, use the PROPID_M_SOAP_ENVELOPE property.

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.

The PROPID_M_SOAP_HEADER property is write-only. If the receiving application attempts to retrieve the PROPID_M_SOAP_HEADER property, MQReceiveMessage or MQReceiveMessageByLookupId returns the warning MQ_INFORMATION_PROPERTY, the individual result for the PROPID_M_SOAP_HEADER property is MQ_INFORMATION_PROPERTY_IGNORED, and the other properties are received correctly.

Equivalent COM Property

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

Example Code

The following code fragment shows how PROPID_M_SOAP_HEADER is specified in arrays that can be used to initialize an MQMSGPROPS structure for setting additional application-generated SOAP header elements.

aMsgPropId[i] = PROPID_M_SOAP_HEADER;       // Property ID  
aMsgPropVar[i].vt = VT_LPWSTR;              // Type indicator  
aMsgPropVar[i].pwszVal = wszSoapHeader;  
i++;  

See Also

Message Properties
MQMSGPROPS
MQSendMessage
MSMQMessage.SoapHeader
PROPID_M_COMPOUND_MESSAGE
PROPID_M_SOAP_BODY
PROPID_M_SOAP_ENVELOPE