WsFlushWriter function (webservices.h)

Instructs the writer to invoke the callback specified in WS_XML_WRITER_STREAM_OUTPUT if sufficient data has been buffered.

Syntax

HRESULT WsFlushWriter(
  [in]           WS_XML_WRITER          *writer,
  [in]           ULONG                  minSize,
  [in, optional] const WS_ASYNC_CONTEXT *asyncContext,
  [in, optional] WS_ERROR               *error
);

Parameters

[in] writer

The writer to flush.

[in] minSize

Specifies the minimum number of bytes that must be buffered in order for the callback to be invoked. If fewer than this number of bytes are buffered, then the callback will not be invoked. This can be used to minimize the number of i/o's that occur when writing small amounts of data.

Zero should be specified to guarantee that the callback is invoked.

[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
E_INVALIDARG
One or more arguments are invalid.
WS_S_ASYNC
The asynchronous operation is still pending.

Remarks

The writer buffers all data until WsFlushWriter is called.

If necessary, the WsFlushWriter should be called before WsFreeWriter to guarantee all data is emitted.

By specifying a WS_ASYNC_CONTEXT the buffered data will be written asynchronously.

This function is a no-op if the writer is using WS_XML_WRITER_BUFFER_OUTPUT.

If WsWriteStartElement has been called, but the element has not been committed (see WsWriteStartElement) then this element will not be flushed.

If this function is called when using WS_XML_WRITER_MTOM_ENCODING and there are no open elements on the writer, then the supporting MIME parts will be generated and emitted. Once this occurs, any API that attempts to write further to the XML document will return WS_E_INVALID_OPERATION. (See Windows Web Services Return Values.)

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