locked
uploading a file along with its actual contents in JAVA RRS feed

  • Question

  •  I am trying to upload a file to healthvault. I am able to upload only the "filename, size and content-type" but unable to upload the actual contents.

    I am using JAVA SDK R1.3.1 . successfully ran the weight app.

    Could you help me in getting the contents also up to healthvault.

    Tuesday, March 5, 2013 9:16 AM

All replies

  • I thought I already answered you in this thread. You may want to find the equivalent calls in Java as the sample code given was in C#.
    Tuesday, March 5, 2013 5:21 PM
  • Thanks santhosh for your reply.

    I am unable to get the equivalent calls in JAVA. As you mentioned this line your code,

     PersonInfo.SelectedRecord.NewItem(file); , could you tell me its JAVA call? Its not there in the SDK that I have. I am able to get the Content-Type up to the healthvault.

    It would be grateful if you could help me in this issue.

    Wednesday, March 6, 2013 9:10 AM
  • Have you downloaded the Java SDK from here and looked at the sample(s) that come along with it? There is a sample describing how to put a Thing type in HealthVault. You can find the Type IDs of Things here.

    Thursday, March 7, 2013 10:17 PM
  • hi,

    Firstly thank you for replying .

    Yes santhosh i downloaded the Java SDK from there itself.

    I rean the weight application successfully and similarily tried and successfully put blood glucose data up to the healhvault.

    But when i try to upload file in a similar approach i get only "filename,file size and content-type" up to healthvault not the contents.

    I tried including "data-other" section to which i pass the encoded data. But it throws me an error saying ("data-other" section is an invalid child tag of the type File) . it is because the File schema provides only filename,file size and content-type.

    Could you tell me if my approach is wrong. or what else am I supposed to do.

    Preferably a sample example code in JAVA would help.

    Thank you.

    Friday, March 8, 2013 3:34 AM
  • Not sure where you are using File as a XML tag. This is what it should look like (replace the place holders with actual value):

    	<info>
    		<thing>
    			<thing-id/>
    			<type-id>bd0403c5-4ae2-4b0e-a8db-1888678e4528</type-id>
    			<thing-state>Active</thing-state>
    			<data-xml>
    				<file>
    					<name>FILE NAME HERE</name>
    					<size>SIZE HERE</size>
    					<content-type/>
    				</file>
    			</data-xml>
    			<data-other content-type="TYPE HERE" content-encoding="base64">BASE64 ENCODED CONTENT HERE</data-other>
    		</thing>
    	</info>


    Monday, March 11, 2013 8:35 PM
  • hi Santhosh,

    Thank you for replying. I shal surely try this and let you know if its working.

    Tuesday, March 12, 2013 2:41 AM
  • Hi Santhosh

    Thank you so much!! I am now able to upload the encoded file upto the healthvault and I can download the file too.

    Mistake that I was making was that I was including <data-other> in side <file> tag. now I am clear as to where to include <data-other>.

    Thank you once again .

    I have another question. Will the downloaded file be in encoded format. If yes then how do we download it (in decoded form,i.e. to get back the original file).

    Thursday, March 14, 2013 3:28 AM