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.

WsAddressMessage function

Addresses a message to a specified endpoint address.


HRESULT WINAPI  WsAddressMessage(
  _In_     WS_MESSAGE*                message,
  _In_opt_ const WS_ENDPOINT_ADDRESS* address,
  _In_opt_ WS_ERROR*                  error


message [in]

Pointer to a WS_MESSAGE structure respresenting the message to be addressed.

address [in, optional]

Pointer to a WS_ENDPOINT_ADDRESS structure containing the endpoint to which to address the message.

Note  Passing NULL to this parameter indicates that no headers are added to the message. This provides a way to set the WS_MESSAGE_PROPERTY_ID to WS_MESSAGE_PROPERTY_IS_ADDRESSED without modifying the set of headers in the message.
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

The message has already been addressed. (The WS_MESSAGE_PROPERTY_IS_ADDRESSED property indicates whether a message has already been addressed.)


One or more arguments are not valid.


The input data was not in the expected format or did not have the expected value.


Insufficient memory to complete the operation.

Other Errors

This function can return other errors not listed above.



If you do not address a message by calling this function, the channel automatically addresses the message with the Endpoint Address passed to WsOpenChannel.

This function marks the message as addressed by setting the WS_MESSAGE_PROPERTY_IS_ADDRESSED property to TRUE.

This function fails if the message has already been addressed and returns WS_E_INVALID_OPERATION.

If a non-NULLWS_ENDPOINT_ADDRESS is passed to the function, the function performs the following additional steps:

  • The header type is set to WS_TO_HEADER (see the WS_HEADER_TYPE enumeration) and the address is set to the value of the url field of WS_ENDPOINT_ADDRESS. If the URL length is zero the WS_ADDRESSING_VERSION-specific representation for an anonymous URL is set for the message.
  • Each header in the WS_XML_BUFFER specified in the headers field of the WS_ENDPOINT_ADDRESS is added to the message. No headers are added if the buffer is NULL.


Minimum supported client

Windows 7 [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | UWP apps]









© 2018 Microsoft