locked
How to upload a xml file to healthvault server from my webservice? RRS feed

  • Question

  • I have written a .net web service method, which is invoked by java application. My java applicaiton will send some data[xml data as a string] to the .net web service method. I will save the string in a xml file in some location. Now I want to take this xml file to the Microsoft HealthVault's PPE.

    My web service method:

    [

    WebMethod(Description = "Adds Message", MessageName = "AddMessage")]
    public string Add(string x)
    {
    string retVal = x;
    string fileLoc = @"D:\CreateFile.xml";
    using (StreamWriter sw = new StreamWriter(fileLoc))
    {
    sw.WriteLine(retVal);
    }

    //After this I want to upload the xml file to the healthvault server. for that, I created an object as below:
    UploadFileToHV uploadFileInstance = new UploadFileToHV();
    uploadFileInstance.UploadFile();
    return retVal;
    }


    UploadFileToHV.cs

     

    public void UploadFile()
    {
    XmlDocument ccdDocument = new XmlDocument();
    ccdDocument.Load(
    @"D:\CreateFile.xml");
    //Now I need to upload the file to the healthvault server. How?
    HealthRecordItem ccd = new HealthRecordItem(CCD_THING_GUID, ccdDocument);//ccd_thing_guid is my applicaiton id, I have that one.
    PersonInfo.SelectedRecord.NewItem(ccd);
    }

    public void UploadFile()
    {
    XmlDocument ccdDocument = new XmlDocument();
    ccdDocument.Load(
    @"D:\CreateFile.xml");
    //Now I need to upload the file to the healthvault server. How?
    HealthRecordItem ccd = new HealthRecordItem(CCD_THING_GUID, ccdDocument);//ccd_thing_guid is my applicaiton id, I have that one.
    PersonInfo.SelectedRecord.NewItem(ccd);
    }

    Wednesday, January 6, 2010 4:32 PM

Answers

  • Hello Kumaresh,

    First of all the CCD_THING_GUID can have the definition like the following,

    readonly Guid CCD_THING_GUID = new Guid("9c48a2b8-952c-4f5a-935d-f3292326bf54"); // This is the CCD thing type id not application ID.

    To upload a CCD document to the HealthVault the method you have used, i.e, using the NewItem method for the record, is correct. Here we have to make sure that the document being uploaded is matching the expected schema for a CCD document. The code you are using for uploading the CCD document looks fine to me. Are you getting any error with it?

    If you are looking for uploading just a file then please have a look into this thread .

    Hope this helps.

    Thanks and Regards,
    Aneesh D.
    Wednesday, January 6, 2010 6:41 PM
  • I don't quite understand your question-- what exactly are you trying to do in Java?  Are you talking about redirecting the user to HealthVault (for application authorization or other UI workflows), or how to call the HealthVault platform web services from Java code (as a server-to-server call), or... ?

    Friday, January 8, 2010 6:25 PM

All replies

  • Hello Kumaresh,

    First of all the CCD_THING_GUID can have the definition like the following,

    readonly Guid CCD_THING_GUID = new Guid("9c48a2b8-952c-4f5a-935d-f3292326bf54"); // This is the CCD thing type id not application ID.

    To upload a CCD document to the HealthVault the method you have used, i.e, using the NewItem method for the record, is correct. Here we have to make sure that the document being uploaded is matching the expected schema for a CCD document. The code you are using for uploading the CCD document looks fine to me. Are you getting any error with it?

    If you are looking for uploading just a file then please have a look into this thread .

    Hope this helps.

    Thanks and Regards,
    Aneesh D.
    Wednesday, January 6, 2010 6:41 PM
  • My query is: How to trigger the .net application[means, transferring from .net environment to healthvault PPE], when a .net web service method is invoked from the java?
    When I do a standalone applicaiton in .net, am able to communicate with healthvault PPE, but When I come from java thro .net web service, how should I trigger the application to call the healthvault server?

    Hope am clear with my query.
    Wednesday, January 6, 2010 7:33 PM
  • I don't quite understand your question-- what exactly are you trying to do in Java?  Are you talking about redirecting the user to HealthVault (for application authorization or other UI workflows), or how to call the HealthVault platform web services from Java code (as a server-to-server call), or... ?

    Friday, January 8, 2010 6:25 PM