WsSetHeader function
Adds or replaces the specified standard header in the message.
Syntax
HRESULT WINAPI WsSetHeader( _In_ WS_MESSAGE* message, _In_ WS_HEADER_TYPE headerType, _In_ WS_TYPE valueType, _In_ WS_WRITE_OPTION writeOption, const void* value, _In_ ULONG valueSize, _In_opt_ WS_ERROR* error );
Parameters
- message [in]
-
The message to set the header in.
The message can be in any state but WS_MESSAGE_STATE_EMPTY.
- headerType [in]
-
The type of header to serialize.
- valueType [in]
-
The type of the value to serialize. See WS_HEADER_TYPE for the set of types supported for each type of header.
- writeOption [in]
-
Whether the header element is required, and how the value is allocated. WS_WRITE_NILLABLE_VALUE and WS_WRITE_NILLABLE_POINTER write options cannot be specified since the header types in WS_HEADER_TYPE are not allowed to be nillable in the respective standards specifications. See WS_WRITE_OPTION for more information.
- value
-
The header value to serialize. See WS_WRITE_OPTION for more information.
- valueSize [in]
-
The size of the value being serialized, in bytes.
- error [in, optional]
-
Specifies where additional error information should be stored if the function fails.
Return value
This function can return one of these values.
| Return code | Description |
|---|---|
|
There are multiple instances of the type of header present in the message. |
|
There was not enough memory available to serialize the header. |
|
One or more of the parameters are incorrect. |
|
This function may return other errors not listed above. |
Remarks
This API allows setting of standard header types (see WS_HEADER_TYPE). For application defined header types, use WsAddCustomHeader.
This API is designed handle types of headers that appear once in the message and are targeted at the ultimate receiver. Headers targeted with a role/actor other than ultimate receiver are ignored by this API.
If a header of the given type (targeted at the ultimate receiver) already exists in the message, it is replaced.
Requirements
|
Minimum supported client | Windows 7 [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server | Windows Server 2008 R2 [desktop apps | Windows Store apps] |
|
Header |
|
|
Library |
|
|
DLL |
|