Is my question not specific to this group ir is just too silly? Approach 1 to retrieve profile: Google.GData.* api has all these great classes to retrive CCR specific profile GAuthSubRequestFactory HealthService HealthQuery HealthFeed XMLExtension and others
Approach 2 to retrieve profile: Use HttpWebRequest and HttpWebResponse classes. This is the approach recommended by the Google Health Data API. If I use this approach then parsing the HTTP response becomes cumbersome. What I am hoping to hear from any of you is: 1) which of the above two approaches is good for developing third party app like mine 2) If the second approach is generic ( which is what developers would use I guess) then I need some tips in parsing the response to extract CCR specific tags. Can someone please reply? On Jun 17, 4:31 pm, vhrao <[email protected]> wrote: > I want to retrieve my profile > The HealthProfile.aspx defines PrintProfile() method that uses > following classes: > GAuthSubRequestFactory > HealthService > HealthQuery > HealthFeed > XMLExtension and others > The output is parsed and neatly displayed. This is great. > > But the Google Health Data API tells us to use HTTP requests and > headers. So I wrote something using HttpWebRequest and HttpWebResponse > class. > I don't know how to parse the HttpWebResponse output using CCR related > tags (similar to the example code HealthProfile.aspx referenced above) > and get the various profiles in a neat manner instead of me parsing > the response. > > Here is my code. Please advise.. > > string request; > string response; > System.Text.StringBuilder respBody = new StringBuilder(); > HttpWebRequest httprequest; > HttpWebResponse httpresponse; > > request = "https://www.google.com/h9/feeds/profile/ > default"; > httprequest =(HttpWebRequest)HttpWebRequest.Create > (request); > httprequest.ContentType = "application/atom+xml"; > httprequest.Headers.Set("Authorization", "AuthSub token=" > + (String) Session["token"]); > //httprequest.Headers.Set("Authorization","GoogleLogin > auth=" + authCode.Trim()); > httpresponse = (HttpWebResponse)httprequest.GetResponse(); > Encoding enc = System.Text.Encoding.GetEncoding(1252); > StreamReader loResponseStream = new StreamReader > (httpresponse.GetResponseStream(), enc); > string Response = loResponseStream.ReadToEnd(); > loResponseStream.Close(); > httpresponse.Close(); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Health Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/googlehealthdevelopers?hl=en -~----------~----~----~----~------~----~------~--~---
