Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WsCreateMessage function

Creates a message object with the specified properties.


HRESULT WINAPI  WsCreateMessage(
  _In_     WS_ENVELOPE_VERSION        envelopeVersion,
  _In_     WS_ADDRESSING_VERSION      addressingVersion,
           const WS_MESSAGE_PROPERTY* properties,
  _In_     ULONG                      propertyCount,
           WS_MESSAGE**               message,
  _In_opt_ WS_ERROR*                  error


envelopeVersion [in]

A WS_ENVELOPE_VERSION enumeration value that specifies the version of the envelope for the message.

addressingVersion [in]

A WS_ADDRESSING_VERSION that specifies the version of the addressing for the message.


An array of optional properties for the message. See WS_MESSAGE_PROPERTY.

The value of this parameter may be NULL, in which case, the propertyCount parameter must be 0 (zero).

propertyCount [in]

The number of properties in the properties array.


On success, a pointer that receives the address of a WS_MESSAGE structure representing the new message.

When you no longer need this structure, you must free it by calling WsFreeMessage.

error [in, optional]

Pointer to a WS_ERROR structure that receives additional error information if the function fails.

Return value

If the function succeeds, it returns NO_ERROR; otherwise, it returns an HRESULT error code.

Return codeDescription

Insufficient memory to complete the operation.


One or more arguments are invalid.

Other Errors

This function may return other errors not listed above.



A message object is the delivery vehicle for Windows Web Services. A single message object can be used to send or receive sequential messages. Reusing a message object in this way can reduce memory allocations. When you no longer need the message, you must free the memory by calling WsFreeMessage. (For more information on reusing message objects, see WsResetMessage .)

If you are creating a message for use with a particular channel, use the WsCreateMessageForChannel function, which will ensure the correct message version for the channel.


Minimum supported client

Windows 7 [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | UWP apps]









© 2018 Microsoft