PutThings2 Example

Feb 16, 2011 at 12:38 AM
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
Coordinator
Feb 16, 2011 at 3:07 AM
Edited Feb 16, 2011 at 3: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

 

--Rob

Coordinator
Feb 16, 2011 at 3: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.

-Rob

Feb 16, 2011 at 3:55 AM

Rob,

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.

Thanks

Shyam

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

Also,

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.

http://social.msdn.microsoft.com/Forums/en-US/healthvault/thread/4b6b294d-4ab5-41fc-9c5e-f93310bc3c60

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.

 

Coordinator
Feb 16, 2011 at 6:17 AM
Edited Feb 16, 2011 at 6: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:

http://msdn.microsoft.com/en-us/healthvault/bb968874.aspx

http://blogs.msdn.com/b/ericgu/archive/2010/07/07/floating-point-numbers-and-string-representations.aspx

 

--Rob