PutThings2 Example

Feb 15, 2011 at 11:38 PM
Hi, Do you think you could post an example of how to use PutThings2Request object. How can I set the DataXml in put things? Hope you can get back to me on this quickly. Thanks Shyam
Feb 16, 2011 at 2:07 AM
Edited Feb 16, 2011 at 2:12 AM

PutThings2 was mainly about adding support for streamed blobs.  There isn't any support for streamed blobs in the sdk so far.  If you don't need streamed blobs, then PutThings v1 is functionally equivalent.  I don't know when I'll get to implementing streamed blob support.  If you need it, maybe you can have a crack at writing it and submit it back.  I'm always happy to look at submissions.

I looked and saw that I had opened up work item for streaming a while back:  http://healthvaultjavalib.codeplex.com/workitem/10515



Feb 16, 2011 at 2:16 AM

After I said that I remembered a submitted patch to add auto-thing-marshalling to PutThings2.  Have a look in the SourceCode tab and view patches.  That said, it still doesn't help streaming too much but can give you the stream refs.


Feb 16, 2011 at 2:55 AM


I ask this question because of a posting response I received from the MSDN forum. Here is a link

<br><br> http://social.msdn.microsoft.com/Forums/en-US/healthvault/thread/feecfb02-d4fe-4ed9-a88d-554af010596f

<br>According to the response - we are to use the most recent version of Methods.


That being said - in PutThings2 - there is no setData() method. I am really not looking to use any streamed blobs. So I am fine working with PutThings - rather than PutThings2Request.

Please advise.



Feb 16, 2011 at 3:29 AM
Edited Feb 16, 2011 at 3:29 AM


I proceeded down this path since the Weight value I was setting was being overwritten. I also posted a question on MSDN forum on that. Here is a link.


Below is the question again.

In the request I make, If I fail to set the <kg> parameter (which translates to a 0.0 value for the <kg> parameter, the request returns with an error (invalid XML). If I convert the value from lbs to Kg, when I choose to edit the field in HealthVault, I do not get the display value but a value converted based on the Kg value. Here is an example:

Display Value: 80 lbs; Kg: converted to 35.36

On the main Weight measurement page - it looks fine. When I select to edit the record, I get the value as 79 lbs and 15.xxx ounces. The value should be 80 lbs as set in the display value.

Is this not the way to set the weight values?

Please let me know what you think.


Feb 16, 2011 at 5:17 AM
Edited Feb 16, 2011 at 5:34 AM

Hi Shyam,

Some of this may be my fault for not being very precise in the SDK examples.  I should update them and be more careful. 

Rest assured this has absolutely nothing to do with the version of PutThings.  It is perfectly acceptable to continue using PutThings v1 for a long long time.  Methods are versioned for backwards compatibility and the old versions remain.

This has everything to do with display-value vs. weight-value, unit conversion and floating point numbers. 

Calculations should always be done on the weight-value which is a *required* field.  The display value is optional.  The HealthVault page displaying the weight table will use the display-value if there is one, and fallback to the weight-value if not.  When you edit the weight, HealthVault will always convert the weight-value into the user's preferred units--in this case lbs--ignoring the display value.  This conversion gives you 79 lbs 15.xxx ounces.  You are doing nothing wrong.

Some links: