WsSetOutput function (webservices.h)

Sets the encoding and output callbacks for the writer. The callbacks are used to provides buffers to the writer and to perform asynchronous i/o.

Syntax

HRESULT WsSetOutput(
  [in]           WS_XML_WRITER                *writer,
  [in, optional] const WS_XML_WRITER_ENCODING *encoding,
  [in, optional] const WS_XML_WRITER_OUTPUT   *output,
                 const WS_XML_WRITER_PROPERTY *properties,
  [in]           ULONG                        propertyCount,
  [in, optional] WS_ERROR                     *error
);

Parameters

[in] writer

The writer for which the output will be set.

[in, optional] encoding

The encoding describes the format of the input bytes. This should be one of WS_XML_WRITER_TEXT_ENCODING, WS_XML_WRITER_BINARY_ENCODING or WS_XML_WRITER_MTOM_ENCODING.

[in, optional] output

Specifies where the writer should place its data.

properties

An array of optional properties of the writer. See WS_XML_WRITER_PROPERTY.

[in] propertyCount

The number of properties.

[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.

Remarks

When WsSetOutput is used on the writer, the writer will function in a forward only manner and the functions WsGetWriterPosition, WsSetWriterPosition and WsMoveWriter cannot be used.

If encoding is NULL, then WS_XML_WRITER_OUTPUT is ignored and the writer is set up so that any attempt to write to it will fail.

If encoding is not NULL, then WS_XML_WRITER_OUTPUT must be non-NULL as well.

If WS_XML_WRITER_OUTPUT is WS_XML_WRITER_BUFFER_OUTPUT then the writer will buffer the generated bytes of the document. Use WsGetWriterProperty with WS_XML_WRITER_PROPERTY_BUFFERS or WS_XML_WRITER_PROPERTY_BYTES to obtain these bytes. In this mode WsFlushWriter has no effect.

If WS_XML_WRITER_OUTPUT is WS_XML_WRITER_STREAM_OUTPUT then the writer will pass the generated bytes of the document to the specified WS_WRITE_CALLBACK during calls to WsFlushWriter.

The writer will be initialized to use the properties specified in WsCreateWriter. Any properties specified to WsSetOutput will override those properties.

See WsCreateWriter for the default values of the properties of the writer.

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