WsAddressMessage function (webservices.h)

Addresses a message to a specified endpoint address.

Syntax

HRESULT WsAddressMessage(
  [in]           WS_MESSAGE                *message,
  [in, optional] const WS_ENDPOINT_ADDRESS *address,
  [in, optional] WS_ERROR                  *error
);

Parameters

[in] message

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

[in, optional] address

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.
 

[in, optional] error

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 code Description
WS_E_INVALID_OPERATION
The message has already been addressed. (The WS_MESSAGE_PROPERTY_IS_ADDRESSED property indicates whether a message has already been addressed.)
E_INVALIDARG
One or more arguments are not valid.
WS_E_INVALID_FORMAT
The input data was not in the expected format or did not have the expected value.
E_OUTOFMEMORY
Insufficient memory to complete the operation.
Other Errors
This function can return other errors not listed above.

Remarks

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.

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