WS_CREATE_ENCODER_CALLBACK callback function (webservices.h)

Handles creating an encoder instance.



HRESULT WsCreateEncoderCallback(
  [in]           void *createContext,
  [in]           WS_WRITE_CALLBACK writeCallback,
  [in]           void *writeContext,
                 void **encoderContext,
  [in, optional] WS_ERROR *error


[in] createContext

The createContext that was specified in the WS_CHANNEL_ENCODER used during channel creation.

[in] writeCallback

The function that should be used to write the message data. This callback should only be used in response to the WS_ENCODER_START_CALLBACK, WS_ENCODER_ENCODE_CALLBACK and WS_ENCODER_END_CALLBACK callbacks.

[in] writeContext

The write context that should be passed to the provided WS_WRITE_CALLBACK.


Returns the encoder instance. This value will be passed to all of the encoder callbacks.

[in, optional] error

Specifies where additional error information should be stored if the function fails.

Return value

This callback function can return one of these values.

Return code Description
Ran out of memory.
One or more arguments are invalid.
Other Errors
This function may return other errors not listed above.


The channel will create encoder instances as necessary. Each encoder instance will be called in a single-threaded fashion. A single encoder instance however should not assume that it will see all messages from a channel, as the channel may use multiple encoder instances for processing messages.


Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header webservices.h