The first release (R1.0) of HealthVault Java Library has been very successful and is being extensively used by HealthVault partners. This library provides basic capabilities to authenticate and exchange XML with HealthVault platform.
Over last few months, thanks to Rob, Siddhartha & Ali we have gained some momentum in developing this library. The current beta release (JAXB integration) includes beginnings of an object model for HealthVault methods and types. Kudos to Rob for some great work here.
If you are already using the community supported HealthVault Java Library, I would encourage you to try the new JAXB Integration release. It will be great to get your feedback before we make this work as our core development codebase. If you are new to working with HealthVault from Java please follow the getting started guide.
Looking forward to comments, feedback and contributions!
Last year I did an N-part series about working with HealthVault XML APIs. It was implemented with ruby on UBuntu Linux system using OpenSSL. I got time to go mark all those articles with next links and I thought i would summarize the series here:
One of our partners has also implemented Drop Off Pick Up solution in ruby using the above articles. Hopefully sometime in near future, I’ll convince them to do a blog post about the same.
So CodePlex launched support for TortoiseSVN, more details about it are here. In the past there have been a couple of HealthVault projects which chose to do something else since SVN was not available on CodePlex, so this is a really great news. The SVN support is through SVN Bridge – essentially CodePlex is now hosting a bridge server which will let you talk to the native TFS project using a SVN client. Well – may be you can check out the HealthVaultD2C sample using TortoiseSVN now .
Folks trying to talk through raw xml layer with HealthVault have asked this a few times – so i thought I’ll put it up here, thanks to Rob for digging the XML.
The key to do a PutThings for an application in offline mode is the following snippet in the auth-session:
11111111-1111-1111-1111-111111111111
An application with OfflineAccess is ready to publish data in a users record once it successfully does the CreateAuthenticateSession call. Here is a sample PutThings call:
Alrite now that you have the firewood (application auth token) and the firestarter (user auth token) how can we start the fire (get details user’s record).
Well first of all congratulations! most of the hard part is done!! Just a few more nitty gritty tricks though! In order to get the details about a user’s health record, you need to use a method GetPersonInfo.
So now do we go about concoting the seemingly complicated xml above. Well we already have the token and wctoken from our previous CreateAuthenticatedSession and Shell -redirect. Use the token for the auth-token in line 9 and the wctoken as user-token in line 10.
Most of the elements in the header section are straight forward. The one to comment about is hash-data (line 18). The hash in this case is SHA-1 hash of the info section. Matter of fact our info section is empty so that make sure that the SHA-1 hash is done right. In ruby i do it the following way (using OpenSSL):
def self.doSha1(text)
Base64.encode64(OpenSSL::Digest::SHA1.digest(text)).chomp
end
Now the interesting part – whats this auth on line 2? Well auth is a HMAC of header (line 5-20) section. Remember we generated the shared secret in CreateAutheticatedSession method? Now use that secret to do a HMAC digest for the header. In ruby i do it the following way:
secret is the shared secret used for createauthenticationtoken.
Now the fun part,caveats:
Don’t leave any white spaces between you xml tags. HealthVault behaves weird sometime when their is white space.
If you are getting an error saying code 3 (which implied invalid xml) and you are sure that your xml is correct, then most likely your auth section or your hash-data section are not proper. Which in turn implies that your HMAC-ing or SHA-1 hashing is a little off. The best way to actually resolve this is to first write tiny parts which make sure that the HMAC /SHA-1 is same for a known successfully call. You can get the xml for such a call from HealthVault SDK, the process is described here. However for ease of testing i’m appending know good calls below.
PLEASE NOTE: Remove all the white-space between tags before testing your crypto functions to match the result seen here. I have put the white space for readability.
Sweet!!! you wanna check out th lighted application? Well its live… (Please Note: it will prompt you yo sign in with HealthVault id, its still rough around edges and doesn’t deal with corner cases).
So lets see your LAMPR application lighted up soon..