WsInitializeMessage function (webservices.h)

This function initializes the headers for the message in preparation for processing. After a message has been initialized an application can add additional headers. On success the message is in WS_MESSAGE_STATE_INITIALIZED state. If the function fails, then no state transitions occurs.

Syntax

HRESULT WsInitializeMessage(
  [in]           WS_MESSAGE                *message,
  [in]           WS_MESSAGE_INITIALIZATION initialization,
  [in, optional] WS_MESSAGE                *sourceMessage,
  [in, optional] WS_ERROR                  *error
);

Parameters

[in] message

A pointer to the Message object to initialize. The Message must be a valid WS_MESSAGE object instance returned by WsCreateMessage or WsCreateMessageForChannel and may not be NULL.

[in] initialization

Defines the Message initialization.

Note  If the initialization value is set to WS_REPLY_MESSAGE or WS_FAULT_MESSAGE the message is automatically addressed.
 

[in, optional] sourceMessage

A pointer to a message object that is used to initialize the message parameter. This value should be NULL unless the initialization parameter has the value of WS_DUPLICATE_MESSAGE, WS_REPLY_MESSAGE, or WS_FAULT_MESSAGE.

[in, optional] error

A pointer to a WS_ERROR object where additional information about the error should be stored if the function fails.

Return value

This function can return one of these values.

Return code Description
E_OUTOFMEMORY
Ran out of memory.
E_INVALIDARG
One or more arguments are invalid.
Other Errors
This function may return other errors not listed above.

Remarks

The initial sender of a message should add an action header to the message using WsSetHeader.

This API must be called before WsWriteEnvelopeStart or WsWriteMessageStart is called for the message.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header webservices.h
Library WebServices.lib
DLL WebServices.dll