Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WsReadBody function

This is a helper function that deserializes a value from the XML Reader of the message. The WS_MESSAGE_STATE must be set to WS_MESSAGE_STATE_READING. This function does not cause any state transitions.

Syntax


HRESULT WINAPI  WsReadBody(
  _In_     WS_MESSAGE*                   message,
  _In_     const WS_ELEMENT_DESCRIPTION* bodyDescription,
  _In_     WS_READ_OPTION                option,
  _In_opt_ WS_HEAP*                      heap,
           void*                         value,
  _In_     ULONG                         valueSize,
  _In_opt_ WS_ERROR*                     error
);

Parameters

message [in]

A pointer to the Message object to read the body from. The pointer must reference a valid WS_MESSAGE object.

bodyDescription [in]

A pointer to the object encapsulating the metadata that describes the mapping of the value to an element.

option [in]

Determines whether the value is required and how to allocate the value. See WS_READ_OPTION for more information.

heap [in, optional]

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.

valueSize [in]

The interpretation of the value of this parameter depends on the WS_READ_OPTION.

error [in, optional]

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 codeDescription
WS_E_INVALID_FORMAT

The input data was not in the expected format or did not have the expected value.

E_OUTOFMEMORY

Ran out of memory.

E_INVALIDARG

One or more arguments are invalid.

Other Errors

This function may return other errors not listed above.

 

Remarks

This functions supports the following scenarios, based on the contents of the WS_ELEMENT_DESCRIPTIONsupplied:

  • 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_TYPEor 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

Minimum supported client

Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | Windows Store apps]

Header

WebServices.h

Library

WebServices.lib

DLL

WebServices.dll

 

 

Community Additions

Show:
© 2017 Microsoft