WS_ENCODER_GET_CONTENT_TYPE_CALLBACK callback function (webservices.h)

Gets the content type of the message.



HRESULT WsEncoderGetContentTypeCallback(
  [in]           void *encoderContext,
  [in]           const WS_STRING *contentType,
  [out]          WS_STRING *newContentType,
  [out]          WS_STRING *contentEncoding,
  [in, optional] WS_ERROR *error


[in] encoderContext

The encoder instance returned by the WS_CREATE_ENCODER_CALLBACK.

[in] contentType

The content type of the encoded message.

[out] newContentType

The callback should return the content type for the newly encoded message here.

[out] contentEncoding

The callback should return the content encoding for the encoded message here.

[in, optional] error

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

Return value

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 callback may inspect the content type provided, and then should return the content type to use for the encoded message.

The content type and content encoding returned must remain valid until the callback is invoked again, or the encoder is freed.

For WS_HTTP_CHANNEL_BINDING, if a non-zero length content encoding is returned, the HTTP header "Content-Encoding" will be added to the message with this value.

For other channel bindings, it is an error to return a non-zero length content encoding.


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