hoangduit / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Deserialize fails with Exception while reflecting ASTM.Org.CCR.OrderRxHistoryType's IDs1 field #402

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
calling getCcrList() in Code below throws exception while reflecting 
ASTM.Org.CCR.OrderRxHistoryType's IDs1 field

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Google.GData.Health;
using Google.GData.Client;
using Google.GData.Extensions;
using System.Xml;
using ASTM.Org.CCR;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;

public class DataRepository
    {
        HealthService service;
        HealthQuery profileQuery;
        public DataRepository(string token)
        {
            GAuthSubRequestFactory authFactory = new GAuthSubRequestFactory("weaver", "exampleCo-exampleApp-1");
            authFactory.Token = token;

            service = new HealthService(authFactory.ApplicationName);
            service.RequestFactory = authFactory;

            profileQuery = new HealthQuery("https://www.google.com/h9/feeds/profile/default");
            profileQuery.Digest = true;
        } 

public List<ContinuityOfCareRecord> getCcrList()
        {
            HealthFeed feed = service.Query(profileQuery);

             List<ContinuityOfCareRecord> CcrList = new List<ContinuityOfCareRecord>();
            foreach (HealthEntry entry in feed.Entries)
            {
                MemoryStream ms = new MemoryStream();
                StreamWriter tw = new StreamWriter(ms);
                tw.Write(entry.CCR.OuterXml);
                tw.Flush();
                ms.Seek(0,SeekOrigin.Begin);
                XmlSerializer serializer =  new XmlSerializer(typeof(ContinuityOfCareRecord));//thrown here
                ContinuityOfCareRecord ccr = (ContinuityOfCareRecord)serializer.Deserialize(ms);
                CcrList.Add(ccr);
            }
             return CcrList;
         }
}

Original issue reported on code.google.com by Christia...@googlemail.com on 8 Jul 2010 at 8:02

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by ccherub...@google.com on 7 Feb 2011 at 5:46

GoogleCodeExporter commented 9 years ago
Support for the deprecated Google Health API has been removed in rev. 1154

Original comment by ccherub...@google.com on 4 Mar 2012 at 6:52