WsSetHeader function (webservices.h)
Adds or replaces the specified standard header in the message.
Syntax
HRESULT 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, optional] WS_ERROR *error
);
Parameters
[in] message
The message to set the header in.
The message can be in any state but WS_MESSAGE_STATE_EMPTY.
[in] headerType
The type of header to serialize.
[in] valueType
The type of the value to serialize. See WS_HEADER_TYPE for the set of types supported for each type of header.
[in] writeOption
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.
[in] valueSize
The size of the value being serialized, in bytes.
[in, optional] error
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
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 |