WsWriteBytes function (webservices.h)

Writes bytes to the writer in a format optimized for the encoding. When writing in a text encoding, it will emit the bytes encoded in base64. When writing to a binary format, it will emit the bytes directly.

Syntax

HRESULT WsWriteBytes(
  [in]           WS_XML_WRITER *writer,
                 const void    *bytes,
  [in]           ULONG         byteCount,
  [in, optional] WS_ERROR      *error
);

Parameters

[in] writer

The writer to which the bytes will be written.

bytes

The bytes to write to the document.

[in] byteCount

The number bytes to write to the document.

[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_E_INVALID_OPERATION
The operation is not allowed due to the current state of the object.
WS_E_QUOTA_EXCEEDED
A quota was exceeded.

Remarks

WsWriteBytes may be called more than once between WsWriteStartAttribute and WsWriteEndAttribute. It may not be combined with WsWriteChars, WsWriteCharsUtf8, WsWriteValue or WsWriteText when writing an attribute.

For the WS_XML_WRITER_MTOM_ENCODING, if the byteCount exceeds the maxInlineByteCount specified during WsSetOutput then the bytes will be buffered and placed in their own MIME part. Otherwise the bytes are encoded in base64 and placed directly in the document.

For the WS_XML_WRITER_MTOM_ENCODING, if the element containing the bytes has an attribute with the name 'contentType' and the namespace 'http://www.w3.org/2004/11/xmlmime', then the value of the attribute will be reflected in the content type header for the MIME part as described in XML-binary Optimized Packaging.

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