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.

WsAddMappedHeader function

Adds a specified mapped header to the message.


HRESULT WINAPI  WsAddMappedHeader(
  _In_     WS_MESSAGE*          message,
  _In_     const WS_XML_STRING* headerName,
  _In_     WS_TYPE              valueType,
  _In_     WS_WRITE_OPTION      writeOption,
  _In_     const void*          value,
  _In_     ULONG                valueSize,
  _In_opt_ WS_ERROR*            error


message [in]

Pointer to a WS_MESSAGE structure representing the message to to which to add the mapped header.

The message can be in any state except WS_MESSAGE_STATE_EMPTY (see the WS_MESSAGE_STATE enumeration.

headerName [in]

Pointer to a WS_XML_STRING containing the name of the header.

valueType [in]

The type of header value to deserialize. For possible types and the corresponding headers, see the WS_HEADER_TYPE

writeOption [in]

Whether the header is required, and how the value is allocated. For more information, see the WS_WRITE_OPTION enumeration.

value [in]

The header value to serialize. For more information, see the WS_WRITE_OPTION enumeration.

valueSize [in]

The size of the value being serialized, in bytes.

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 of the parameters are incorrect.

Other Errors

This function may return other errors not listed above.



A message may contain additional transport-specific information that is not part of the message envelope. This transport-specific information can be exposed programmatically as headers of the message. The WsAddMappedHeader function is used to add such a header that will be mapped into some transport-specific location.

When you use the HTTP channel, you must specify the required mappings before before you call this function to add the headers. For more information, see WS_HTTP_MESSAGE_MAPPING.

If you are replacing a header, call the WsRemoveMappedHeader function to remove the existing instances of the header before you call WsAddMappedHeader.


Minimum supported client

Windows 7 [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | UWP apps]









© 2018 Microsoft