WS_CHANNEL_DECODER structure (webservices.h)

A structure that is used to specify a set of callbacks that can transform the content type and encoded bytes of a received message.

Syntax

typedef struct _WS_CHANNEL_DECODER {
  void                                 *createContext;
  WS_CREATE_DECODER_CALLBACK           createDecoderCallback;
  WS_DECODER_GET_CONTENT_TYPE_CALLBACK decoderGetContentTypeCallback;
  WS_DECODER_START_CALLBACK            decoderStartCallback;
  WS_DECODER_DECODE_CALLBACK           decoderDecodeCallback;
  WS_DECODER_END_CALLBACK              decoderEndCallback;
  WS_FREE_DECODER_CALLBACK             freeDecoderCallback;
} WS_CHANNEL_DECODER;

Members

createContext

A context that will be passed to the WS_CREATE_DECODER_CALLBACK.

createDecoderCallback

A WS_CREATE_DECODER_CALLBACK callback that creates an instance of a decoder.

decoderGetContentTypeCallback

A WS_DECODER_GET_CONTENT_TYPE_CALLBACK callback that is invoked to get the content type of the message.

decoderStartCallback

A WS_DECODER_START_CALLBACK callback that is invoked at the start of decoding a message.

decoderDecodeCallback

A WS_DECODER_DECODE_CALLBACK callback that is invoked to decode a message.

decoderEndCallback

A WS_DECODER_END_CALLBACK callback that is invoked at the end of decoding a message.

freeDecoderCallback

A WS_FREE_DECODER_CALLBACK callback that frees an instance of a decoder.

Remarks

A WS_CHANNEL may wish to decompress, modify, or otherwise transform the encoded bytes of a message as soon as they are received. A WS_CHANNEL_DECODER provides the necessary hooks to intercept and perform these modifications.

When creating the channel, the WS_CHANNEL_PROPERTY_DECODER should be set with the appropriate functions.

The callbacks specified will get invoked according to the following grammar:


decodercalls := create decoderloop* free
decoderloop  := decodestart
             |  decodestart getcontenttype
             |  decodestart getcontenttype (decode*)
             |  decodestart getcontenttype (decode*) decodeend

The decoder may not see the full decode sequence for a message if the channel or the decoder encounters an error while reading the message. A decoder must be prepared to handle transitioning to the appropriate state based upon the callbacks invoked.

When using WS_TCP_CHANNEL_BINDING with WS_CHANNEL_TYPE_SESSION, the content type is fixed for the channel. In this case, the WS_DECODER_GET_CONTENT_TYPE_CALLBACK must return exactly the same value for the content type of every message.

The WS_DECODER_END_CALLBACK will not be invoked until WS_DECODER_DECODE_CALLBACK returns 0 bytes.

When the channel is finished using the decoder instance it will free it via the WS_FREE_DECODER_CALLBACK.

Requirements

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