WsShutdownSessionChannel function (webservices.h)

Used to signal the end of messages for a session channel.


HRESULT WsShutdownSessionChannel(
  [in]           WS_CHANNEL             *channel,
  [in, optional] const WS_ASYNC_CONTEXT *asyncContext,
  [in, optional] WS_ERROR               *error


[in] channel

The session channel to shut down.

[in, optional] asyncContext

Information on how to invoke the function asynchronously, or NULL if invoking synchronously.

[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
This is returned if the channel is not in the WS_CHANNEL_STATE_OPEN state.


This function will indicate to the remote party that all messages have been sent for the channel.

The remote party can detect that no more messages are available on the channel by looking for the WS_S_END return value when receiving a message. (See Windows Web Services Return Values.) However, messages can also become unavailable if the non-application messages were filtered by the channel as described in Channel Layer Overview. Session shutdown can be distinguished from message filtering by keeping track of whether prior messages were received. If prior messages were received then the session was shut down.

This function only applies to channels created with a WS_CHANNEL_TYPE with a session that support sending of messages:

The channel must be in WS_CHANNEL_STATE_OPEN state.

If this function is successful, the value of the WS_CHANNEL_PROPERTY_IS_SESSION_SHUT_DOWN property will be TRUE.

Once a session channel has been shut down, attempting to send a message on the channel or attempting to shut down the channel will return WS_E_INVALID_OPERATION.

Calling this function is optional. When a session channel is closed using WsCloseChannel when in WS_CHANNEL_STATE_OPEN, then the channel is automatically shut down as part of the close process.


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