WsWriteBody function (webservices.h)
Writes a value in the body of a message. This is a helper function that serializes a value to the XML Writer of the message. The message state must be set to WS_MESSAGE_STATE_WRITING. This function does not cause any state transitions.
Syntax
HRESULT WsWriteBody(
[in] WS_MESSAGE *message,
[in] const WS_ELEMENT_DESCRIPTION *bodyDescription,
[in] WS_WRITE_OPTION writeOption,
const void *value,
[in] ULONG valueSize,
[in, optional] WS_ERROR *error
);
Parameters
[in] message
A pointer to the Message object for writing to. The pointer must reference a valid WS_MESSAGE object.
[in] bodyDescription
A pointer to information describing how to write the value.
[in] writeOption
Determines whether the value is required and how the value is allocated.
value
A void pointer to the value to write.
[in] valueSize
The size in bytes of the value to write. If the value is NULL the size should be 0.
[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 |
---|---|
|
The input data was not in the expected format or did not have the expected value. |
|
Ran out of memory. |
|
One or more arguments are invalid. |
|
This function may return other errors not listed above. |
Remarks
This functions supports the following scenarios, based on the contents of the WS_ELEMENT_DESCRIPTION supplied:
- Writing a single element. In this case, the elementLocalName and elementNs fields of the WS_ELEMENT_DESCRIPTION should be set to the local name and namespace of the element to write, and the type and type description represents the type of the value being serialized. If using WS_FAULT_TYPE or WS_ENDPOINT_ADDRESS_TYPE, it is not necessary to specify the local name, namespace, or type description (they will default appropriately based on the envelope/addressing version of the message).
- Writing multiple elements as a single value. In this case, the elementLocalName and elementNs fields of the WS_ELEMENT_DESCRIPTION should be set to NULL, and a WS_STRUCT_TYPE and WS_STRUCT_DESCRIPTION should be specified. In this case, each field of the structure value being serialized should correspond to element(s) to write within the body.
- Writing multiple elements as multiple values. Writing multiple distinct values can be accomplished by simply calling the function multiple times.
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 |