WsPushBytes function (webservices.h)

Establishes a callback to be invoked to write bytes within an element. In some encodings this can be more efficient by eliminating a copy of the data.

Syntax

HRESULT WsPushBytes(
  [in]           WS_XML_WRITER          *writer,
  [in]           WS_PUSH_BYTES_CALLBACK callback,
  [in, optional] void                   *callbackState,
  [in, optional] WS_ERROR               *error
);

Parameters

[in] writer

A pointer to the XML Writer object to which the bytes are written. The pointer must reference a valid WS_XML_WRITER and the referenced value may not be NULL.

[in] callback

This parameter is the callback to invoke to write the data.

[in, optional] callbackState

A pointer to a user-defined state that is passed to the callback function.

[in, optional] error

A pointer to a WS_ERROR object where additional information about the error 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_E_INVALID_OPERATION
The operation is not allowed due to the current state of the object.

Remarks

When writing with the WS_XML_WRITER_MTOM_ENCODING, WsPushBytes provides a way to write bytes directly into its own MIME part and avoid a copy. However, the writer at its discretion, may choose to invoke the callback immediately, so the caller should be prepared for this.

If the encoding cannot take advantage of this behavior, then WsPushBytes will invoke the callback immediately and operate as if WsWriteBytes was called.

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