Uploading of file to Microsoft healthvault using Java API

Dec 1, 2011 at 1:22 PM

Hi there,

I have requirement to upload audio file (.mp3 ) to microsoft healthvault using Java API.

Currently there is no sample or snippet available on web to show how exactly this requirement can be met.

Issue is Java library allows only uploading of file schema and not actual contents

http://developer.healthvault.com/sdk/docs/urn.com.microsoft.wc.thing.file.file.1.inlinetype.html

there are only three set options in java library for file

-           Name

-          Size

-          CodableValue (contentType)

 there is no option to set actual content or content path  in java

In C#, its available as

Microsoft.Health.ItemTypes.File file =    File.CreateFromFilePath(@"C:\My Pictures\picture.jpg”, new CodableValue("image/jpg"));

PersonInfo.SelectedRecord.NewItem(file);

 

I tried to add set option for path (in XML payload of file ) but I got error response XML from healthvault system 

Then I went with second approach wherein I tried to upload File Schema + Blob carrying file content data using version 2 API since version 1 doesn’t supports

blobPayload under thing packet  

This time file got uploaded and got listed under uploaded files head but it was again lacking blob contents since while uploading I specified typeId for file and not for Blob (which I didn’t find in API docs)

 I am stuck in getting file uploaded with data on healt vault system and there is no working sample available on web for this.

 Can anybody provide help on this ? Thanks in advance (Its urgent)

Coordinator
Dec 2, 2011 at 9:27 PM

Hi,

I have not yet implemented blob streaming for this library.  How large are the mp3 files you are uploading?  If they are less than 12MB or so, you can include them as an inline blob.

The blob itself is Base64 encoded and placed in the DataOther element. 

 

DataOther data = new DataOther();
data.setContentType("audio/mp3");
data.setValue(mp3AsBase64);

thing.setDataOther(data);


Does that help? I don't have an example to use but it would be worthwhile to include a test and example for this case.

--Rob