WsReadBody function (webservices.h)
This is a helper function that deserializes a value from the XML Readerof the message. The WS_MESSAGE_STATE must be set to WS_MESSAGE_STATE_READING. This function does not cause any state transitions.
Syntax
HRESULT WsReadBody(
[in] WS_MESSAGE *message,
[in] const WS_ELEMENT_DESCRIPTION *bodyDescription,
[in] WS_READ_OPTION readOption,
[in, optional] WS_HEAP *heap,
void *value,
[in] ULONG valueSize,
[in, optional] WS_ERROR *error
);
Parameters
[in] message
A pointer to the Message object to read the body from. The pointer must reference a valid WS_MESSAGE object.
[in] bodyDescription
A pointer to the object encapsulating the metadata that describes the mapping of the value to an element.
[in] readOption
Determines whether the value is required and how to allocate the value. See WS_READ_OPTION for more information.
[in, optional] heap
A pointer to the Heap object to read the element into. The pointer must reference a valid WS_HEAP object.
value
The interpretation of the data referenced by this parameter depends on the WS_READ_OPTION.
[in] valueSize
The interpretation of the value of this parameter depends on the WS_READ_OPTION.
[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:
- Reading 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 read, and the type and type description represents the type of the value being deserialized. 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).
- Reading 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 deserialized should correspond to element(s) to read within the body.
- Reading multiple elements as multiple values. Reading 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 |