Download a file from Microsoft HealtVault.

Jul 17, 2011 at 9:23 PM
Edited Jul 17, 2011 at 9:35 PM


Is there a code snippet which can be used to download a File from Microsoft Health Vault in the Android platform? Also the code available on How to do for uploading file, does it support Android?


Jul 18, 2011 at 6:07 PM

Hi Sana,

There isn't an example using the Java sdk.  Using the Android library you will be creating and parsing the XML requests directly.  Here is a blog post describing the XML format necessary for blob support:


Jul 18, 2011 at 10:36 PM
Edited Jul 18, 2011 at 11:22 PM

So with the blog, I followed it step by step and added the new extra section.


String infoFile = "<info><group max=\"100\"><filter><type-id>" +
        File.TYPE +
        "</type-id></filter><format><section>core</section><section>blobpayload</section> " +

But it gives me a xml parse error saying that section element is invalid and bobpayload is invalid according to its datatypes.....


Also in the documentation under "" I don't see any bobpayload enum at all. Am I missing something here?


Just to add to the bloggers curiosity, when I add the filter "<section>otherdata</section>" it gives me the response in

<data-other content-type="text/plain" content-encoding="base64">***Content here is in Base64 format***</data-other>

which I encode it back to my format.


So I would like to know which is a cleaner method of doinf stuff? the blog or should I go ahead with "otherdata"?

Jul 19, 2011 at 12:34 AM

The blobpayload section was added in GetThings version 3.  It's best to use the latest versions of the methods:  GetThings v3, PutThings v2.


Jul 19, 2011 at 4:34 PM
Edited Jul 19, 2011 at 5:28 PM

So I guess for uploading I will be using PutThings version 2.


I guess it should have been updated in the blog with version 3. Anyways thanks a lot for fetching data it worked perfect!


Thanks a lot, the documentation of HealthVault has to be updated! Can anyone voluntarily update them?

Jul 17, 2012 at 1:22 PM
Edited Jul 17, 2012 at 5:51 PM

In case anyone is reading these older discussions, here are the steps required to get this working on android; just add a few lines to the code for the "Weighter" sample app as indicated below:

public static String getRawXml_n_BinaryData(Record record, String HV_TYPE) {
    SimpleRequestTemplate template = new SimpleRequestTemplate(

    String info = "<info>" +
    "<group max=\"25\">" +
        "<filter>" + 
            "<type-id>" + HV_TYPE + "</type-id>" + 
        "</filter><format>" + 
            "<section>core</section>" +
            "<section>blobpayload</section>" +
            "<xml/>" + 
            "<type-version-format>" + HV_TYPE + "</type-version-format>" +
            "<blob-payload-request>" +
                "<blob-format>" +
                    "<blob-format-spec>inline</blob-format-spec>" +
                "</blob-format>" +
            "</blob-payload-request>" +						
        "</format>" + 
    "</group>" +

    Request request = new Request();

(Note that you don't need to mess around with fancy imports or changing the method name; just use "3" for the method version)


Jul 19, 2012 at 10:18 PM

Thanks for adding to the knowledge here!

Jul 5, 2013 at 11:58 AM
I am using the following Health Vault iOS SDK :

Can someone help me to download a file from Health Vault using the SDK API's?