Health​Service​Request Class


Represents an individual request to a HealthVault service. The class wraps up the XML generation and web request/response.

public class HealthServiceRequest


An instance of this class can be retrieved by calling the CreateRequest(String, Int32) method. This class is not thread safe. A new instance should be created when multiple requests must execute concurrently.


Health​Service​Request(​Health​Service​Connection, ​String, ​Int32)

Creates a new instance of the HealthServiceRequest class for the specified method.

Health​Service​Request(​Health​Service​Connection, ​String, ​Int32, ​Health​Record​Accessor)

Creates a new instance of the HealthServiceRequest class for the specified method.



Gets or sets the culture-code for the request.


Gets or sets the identifier of the person being impersonated.


Gets or sets the method name to call.


Gets or sets the version of the method to call.


Gets or sets the parameters for the method invocation. The parameters are specified via XML for the particular method.


Gets or sets the record identifier.


Gets or sets the request compression method used by the connection.


Gets the response after Execute is called.


Defines a delegate that gets or sets all responses for requests to the HealthVault Service.


Gets or sets the timeout for the request, in seconds.



Connects the XML using default values.


Connects the XML using the specified optional XSL.


Cancels any pending request to HealthVault that was initiated with the same connection as this request.


Builds up the XML, makes the request and reads the response. Connectivity failures will except out of the http client


Same as Execute, but takes a transform url (or tag) that is used to transform the result (on the server). Since the response is no longer necessarily xml, it is returned as a string


Gets the correlation id that was set by the user. For web applications, the correlation id was set inside of HttpContext.Current.Items, so GetCorrelationId will retrieve from the HttpContext

        For non web applications, it will return whatever was set in the [ThreadStatic] variable.

Gets the last response id that was returned by the HealthVault platform. The response id is found in the response headers and is set when a request finishes executing.

        For web applications, the response id is stored in the HttpContext items to be shared across
        the web request.

        For non web applications, the response id is stored in thread local storage so the last response
        in the current thread will be returned.

        If an error occurs / exception thrown, the caller can call GetLastResponseId to get that response
        id which can be used to look up error information in the HealthVault logs.
Handle​Response(​Stream, ​Web​Header​Collection)

Represents the Microsoft.Health.IEasyWebResponseHandler callback.

Handle​Response​Result(​Stream, ​Web​Header​Collection)

Handles the response data and headers retrieved from the web request.


Represents the Microsoft.Health.IEasyWebResponseHandler callback.


Handles the data retrieved by making the web request.


To allow applications to keep track of calls to platform, the application can optionally set a correlation id. This will be passed up in web requests to HealthVault and used when HealthVault writes to its logs. If issues occur, this id can be used by the HealthVault team to help debug the issue.

        For applications, we want to avoid the use of thread local for setting
        the request id since a single web request is not guaranteed to fully execute on the
        same thread - using HttpContext.Items is the recommended way.

        For non web applications, this method sets a [ThreadStatic] variable which stores the 
        id in thread local storage. All HealthVault requests made on this thread will re-use this