WsGetCustomHeader function (webservices.h)

Finds an application-defined header of the message and deserializes it.

Syntax

HRESULT WsGetCustomHeader(
  [in]           WS_MESSAGE                   *message,
  [in]           const WS_ELEMENT_DESCRIPTION *customHeaderDescription,
  [in]           WS_REPEATING_HEADER_OPTION   repeatingOption,
  [in]           ULONG                        headerIndex,
  [in]           WS_READ_OPTION               readOption,
  [in, optional] WS_HEAP                      *heap,
                 void                         *value,
  [in]           ULONG                        valueSize,
                 ULONG                        *headerAttributes,
  [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] customHeaderDescription

A WS_ELEMENT_DESCRIPTION which describes the header element.

[in] repeatingOption

Whether the header may appear more than once in the message.

If WS_REPEATING_HEADER is used, then the header index indicates which of the headers with the specified headerName to return.

If WS_SINGLETON_HEADER is used, then the headerIndex must be zero.

[in] headerIndex

The zero-based index of the header within the set of headers with the specified headerName.

[in] readOption

Whether the value is required, and how to allocate the value. 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 as required by the WS_READ_OPTION.

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.

headerAttributes

Returns the WS_HEADER_ATTRIBUTES for this header. The pointer may be NULL, in which case no attributes are returned.

[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.

WS_SINGLETON_HEADER was specified, and 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 operates on headers 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