WsGetHeader function (webservices.h)

Finds a particular standard header in the message and deserializes it.

Syntax

HRESULT WsGetHeader(
  [in]           WS_MESSAGE     *message,
  [in]           WS_HEADER_TYPE headerType,
  [in]           WS_TYPE        valueType,
  [in]           WS_READ_OPTION readOption,
  [in, optional] WS_HEAP        *heap,
                 void           *value,
  [in]           ULONG          valueSize,
  [in, optional] WS_ERROR       *error
);

Parameters

[in] message

The message containing the header.

The message can be in any state but WS_MESSAGE_STATE_EMPTY.

[in] headerType

The type of header to deserialize.

[in] valueType

The type of value to deserialize. See WS_HEADER_TYPE for the set of types which correspond to each type of header.

[in] readOption

Whether the value is required, and how to allocate the value. WS_READ_NILLABLE_VALUE and WS_READ_NILLABLE_POINTER read 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_READ_OPTION for more information.

[in, optional] heap

The heap to store the deserialized header data in. If this is NULL, then the message heap will be used.

value

The interpretation of this parameter depends on the WS_READ_OPTION.

[in] valueSize

The interpretation of this parameter depends on the WS_READ_OPTION.

[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
WS_E_INVALID_FORMAT
The header does not exist, and is required.

There are multiple instances of the type of header present in the message.

The input data was not in the expected format.

WS_E_QUOTA_EXCEEDED
The size quota of the heap was exceeded.
E_OUTOFMEMORY
There was not enough memory available to deserialize the header.
E_INVALIDARG
One or more of the parameters are incorrect.
Other Errors
This function may return other errors not listed above.

Remarks

This API provides access to a set of standard header types (see WS_HEADER_TYPE). For application defined header types, use WsGetCustomHeader.

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.

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