what's the contents of the ResponseString of the Exception?
Frank
On Mar 6, 2009, at 3:20 AM, Aidan P Calnan wrote:
>
> thanks Frank,
>
> I added that to my code and i now have GDataRequestException on the
> line:
> HealthFeed feed = service.Query(new
> HealthQuery(HealthQuery.ProfileListFeed));
>
> full code is below, thanks to anyone who can help
>
> private void Login_Click(object sender, System.EventArgs e)
> {
> this.service.setUserCredentials(this.Username.Text,
> this.Password.Text);
> this.authToken = this.service.QueryAuthenticationToken();
> this.Close();
>
>
> //string pid = findValue(args, "pid", null);
> //string pname = findValue(args, "pname", null);
>
>
>
>
> //HealthService service = new HealthService("exampleCo-
> exampleApp-1");
> //service.setUserCredentials("[email protected]
> ", "jakaveli");
>
>
>
>
> GAuthSubRequestFactory authFactory = new
> GAuthSubRequestFactory("weaver", "exampleCo-exampleApp-1");
> HealthService service = new
> HealthService(authFactory.ApplicationName);
> service.RequestFactory = authFactory;
> service.setUserCredentials("[email protected]
> ", "jakaveli");
>
>
>
>
>
> AtomEntry newNotice = new AtomEntry();
> newNotice.Title.Text = "A test message";
> newNotice.Content.Content = "This is a test message.";
> // Set the content type if you're using HTML in your
> message body
> newNotice.Content.Type = "html";
> String ccrXmlString = @"<ContinuityOfCareRecord
> xmlns='urn:astm-org:CCR'
> >
> <Body>
> <Problems>
> <Problem>
> <DateTime>
> <Type>
>
> <Text>Start date</Text>
> </Type>
>
> <ExactDateTime>2007-04-04T07:00:00Z</ExactDateTime>
> </DateTime>
> <DateTime>
> <Type>
>
> <Text>Stop date</Text>
> </Type>
>
> <ExactDateTime>2008-07-20T07:00:00Z</ExactDateTime>
> </DateTime>
> <Description>
> <Code>
>
> <Value>346.80</Value>
>
> <CodingSystem>ICD9</CodingSystem>
>
> <Version>2004</Version>
> </Code>
> </Description>
>
> <Status><Text>Active</Text></Status>
> <Source>
> <Actor>
>
> <ActorID>Harris Smith</ActorID>
> <ActorRole>
>
> <Text>Treating clinician</Text>
> </
> ActorRole>
> </Actor>
> </Source>
> </Problem>
> </Problems>
> </Body>
> </ContinuityOfCareRecord>";
> XmlDocument ccrDoc = new XmlDocument();
> ccrDoc.LoadXml(ccrXmlString);
> newNotice.ExtensionElements.Add(new
> XmlExtension(ccrDoc.DocumentElement));
> //service.Insert(new
> Uri("https://www.google.com/health/feeds/register/default
> "), newNotice);
> //service.Insert(new
> Uri("https://www.google.com/h9/feeds/register/ui/profileID
> "), newNotice);
>
>
> //if (pid == null && pname != null)
> //{
> // // need to find the ID first.
> // // so we get the list feed, find the name in the
> TITLE, and then
> // // get the ID out of the content field
> // HealthFeed feed = service.Query(new
> HealthQuery(HealthQuery.ProfileListFeed));
> // foreach (AtomEntry entry in feed.Entries)
> // {
> // if (entry.Title.Text == pname)
> // {
> // pid = entry.Content.Content;
> // }
> // }
> //}
>
> HealthFeed feed = service.Query(new
> HealthQuery(HealthQuery.ProfileListFeed));
> Console.WriteLine("Feed =" + feed);
> foreach (AtomEntry entry in feed.Entries)
> {
> Console.WriteLine("\tProfile " + entry.Title.Text + "
> has ID: " + entry.Content.Content);
> }
> return;
>
> try
> {
> //service.Insert(new
> Uri("https://www.google.com/h9/feeds/register/default
> "), newNotice);
> service.Insert(new
> Uri("https://www.google.com/h9/feeds/register/ui/profileID
> "), newNotice);
> }
> catch (GDataRequestException err)
> {
> MessageBox.Show(err.ResponseString);
> //MessageBox.Show(err.);
> //err.Response.GetResponseStream();
> //err.Response.GetType();
> }
>
>
>
>
>
> //HealthQuery profileQuery = new
> HealthQuery("https://www.google.com/health/feeds/profile/default
> ");
> //HealthQuery profileQuery = new
> HealthQuery("https://www.google.com/h9/feeds/profile/default
> ");
> HealthQuery profileQuery = new
> HealthQuery("https://www.google.com/h9/feeds/profile/ui/profileID
> ");
> profileQuery.Digest = true;
> // returns a single <atom:entry> containing the user's CCR
> try
> {
> HealthFeed feed2 = service.Query(profileQuery);
> foreach (HealthEntry entry in feed2.Entries)
> {
> XmlNode ccr = (XmlExtension)
> entry.FindExtension("ContinuityOfCareRecord", "urn:astm-org:CCR");
> if (ccr != null)
> {
>
> System.Web.HttpContext.Current.Response.Write("<pre>");
> StringWriter sw = new StringWriter();
> XmlTextWriter xw = new XmlTextWriter(sw);
> xw.Formatting = Formatting.Indented;
> ccr.WriteTo(xw);
>
> System
> .Web
> .HttpContext
> .Current.Response.Write(HttpUtility.HtmlEncode(sw.ToString()));
>
> System.Web.HttpContext.Current.Response.Write("</pre>");
>
> Console.WriteLine("ccr is not null");
> }
> }
> }
> catch (GDataRequestException err)
> {
> MessageBox.Show(err.ResponseString);
> }
> }
>
> Regards,
> Aidan
> ----- Original Message -----
> From: "Frank Mantek" <[email protected]>
> To: "Google Health Developers" <[email protected]
> >
> Sent: Thursday, 5 March, 2009 13:32:23 GMT +00:00 GMT Britain,
> Ireland, Portugal
> Subject: [Google-Health-API] Re: GDataRequestException in .Net
>
>
> When you look into the main.cs file above, it has an option to LIST
> the users profile feeds. When you follow that codepath, this is code
> you could use to populate a listbox picker for a user to choose his
> profile with.
>
> That code here:
>
> HealthFeed feed = service.Query(new HealthQuery
> (HealthQuery.ProfileListFeed));
> Console.WriteLine ("Feed =" + feed);
> foreach (AtomEntry entry in feed.Entries)
> {
> Console.WriteLine("\tProfile " +
> entry.Title.Text + " has ID: " + entry.Content.Content);
> }
> return;
>
> then gives you a profile name and a profile id.
>
>
> Frank
>
> On Mar 5, 1:09 pm, Aidan P Calnan
> <[email protected]> wrote:
>> Thanks Frank,
>>
>> I do need to know what profile i am working with but am unsure on
>> how to get the profileID. what exactly did u mean by "So you either
>> had a picker before that has choosen the name or some UI like
>> that." Also you say "So remember the name or id, and reference it
>> below...", where do i get the name or id to remember?
>>
>> thanks for any help,
>> Aidan
>>
>> ----- Original Message -----
>> From: "Frank Mantek" <[email protected]>
>> To: [email protected]
>> Sent: Thursday, 5 March, 2009 10:33:07 GMT +00:00 GMT Britain,
>> Ireland, Portugal
>> Subject: [Google-Health-API] Re: GDataRequestException in .Net
>>
>> Don't you need to know what profile you are working with? Somewhere
>> in
>> your code you have to pick the profile you are working on, and you
>> need to pass that information around...
>>
>> So you either had a picker before that has choosen the name or some
>> UI
>> like that. So remember the name or id, and reference it below...
>>
>> Frank Mantek
>> Google
>> On Mar 4, 2009, at 10:32 PM, Aidan P Calnan wrote:
>>
>>> Thanks Eric,
>>
>>> This code is very helpful but i have one problem; In the sample you
>>> sent me you are using args from static void Main(string[] args) to
>>> findValue() of the pID. I am using a GUI and my code is behind the
>>> login button and there is no main method. How can i get the right
>>> args to use here?
>>> My code is shown below:
>>
>>> private void Login_Click(object sender, System.EventArgs e)
>>> {
>>> this.service.setUserCredentials(this.Username.Text,
>>> this.Password.Text);
>>> this.authToken = this.service.QueryAuthenticationToken();
>>> this.Close();
>>
>>> string pid = findValue(args, "pid", null);
>>> string pname = findValue(args, "pname", null);
>>
>>> //HealthService service = new HealthService("exampleCo-
>>> exampleApp-1");
>>> //
>>> service.setUserCredentials("[email protected]
>>> ", "jakaveli");
>>
>>> GAuthSubRequestFactory authFactory = new
>>> GAuthSubRequestFactory("weaver", "exampleCo-exampleApp-1");
>>> HealthService service = new
>>> HealthService(authFactory.ApplicationName);
>>> service.RequestFactory = authFactory;
>>>
>>> service.setUserCredentials("[email protected]
>>> ", "jakaveli");
>>
>>> AtomEntry newNotice = new AtomEntry();
>>> newNotice.Title.Text = "A test message";
>>> newNotice.Content.Content = "This is a test message.";
>>> // Set the content type if you're using HTML in your
>>> message body
>>> newNotice.Content.Type = "html";
>>> String ccrXmlString = @"<ContinuityOfCareRecord
>>> xmlns='urn:astm-org:CCR'
>>
>>> <Body>
>>> <Problems>
>>> <Problem>
>>> <DateTime>
>>> <Type>
>>
>>> <Text>Start date</Text>
>>> </Type>
>>
>>> <ExactDateTime>2007-04-04T07:00:00Z</ExactDateTime>
>>> </DateTime>
>>> <DateTime>
>>> <Type>
>>
>>> <Text>Stop date</Text>
>>> </Type>
>>
>>> <ExactDateTime>2008-07-20T07:00:00Z</ExactDateTime>
>>> </DateTime>
>>> <Description>
>>> <Code>
>>
>>> <Value>346.80</Value>
>>
>>> <CodingSystem>ICD9</CodingSystem>
>>
>>> <Version>2004</Version>
>>> </Code>
>>> </Description>
>>
>>> <Status><Text>Active</Text></Status>
>>> <Source>
>>> <Actor>
>>
>>> <ActorID>Harris Smith</ActorID>
>>>
>>> <ActorRole>
>>
>>> <Text>Treating clinician</Text>
>>> </
>>> ActorRole>
>>> </Actor>
>>> </Source>
>>> </Problem>
>>> </Problems>
>>> </Body>
>>> </ContinuityOfCareRecord>";
>>> XmlDocument ccrDoc = new XmlDocument();
>>> ccrDoc.LoadXml(ccrXmlString);
>>> newNotice.ExtensionElements.Add(new
>>> XmlExtension(ccrDoc.DocumentElement));
>>> //service.Insert(new
>>> Uri("https://www.google.com/health/feeds/register/default
>>> "), newNotice);
>>> //service.Insert(new
>>> Uri("https://www.google.com/h9/feeds/register/ui/profileID
>>> "), newNotice);
>>
>>> if (pid == null && pname != null)
>>> {
>>> // need to find the ID first.
>>> // so we get the list feed, find the name in the
>>> TITLE, and then
>>> // get the ID out of the content field
>>> HealthFeed feed = service.Query(new
>>> HealthQuery(HealthQuery.ProfileListFeed));
>>> foreach (AtomEntry entry in feed.Entries)
>>> {
>>> if (entry.Title.Text == pname)
>>> {
>>> pid = entry.Content.Content;
>>> }
>>> }
>>> }
>>
>>> try
>>> {
>>> //service.Insert(new
>>> Uri("https://www.google.com/h9/feeds/register/default
>>> "), newNotice);
>>> service.Insert(new
>>> Uri("https://www.google.com/h9/feeds/register/ui/profileID
>>> "), newNotice);
>>> }
>>> catch (GDataRequestException err)
>>> {
>>> MessageBox.Show(err.ResponseString);
>>> //MessageBox.Show(err.);
>>> //err.Response.GetResponseStream();
>>> //err.Response.GetType();
>>> }
>>
>>> //HealthQuery profileQuery = new
>>> HealthQuery("https://www.google.com/health/feeds/profile/default
>>> ");
>>> //HealthQuery profileQuery = new
>>> HealthQuery("https://www.google.com/h9/feeds/profile/default
>>> ");
>>> HealthQuery profileQuery = new
>>> HealthQuery("https://www.google.com/h9/feeds/profile/ui/profileID
>>> ");
>>> profileQuery.Digest = true;
>>> // returns a single <atom:entry> containing the user's
>>> CCR
>>> try
>>> {
>>> HealthFeed feed = service.Query(profileQuery);
>>> foreach (HealthEntry entry in feed.Entries)
>>> {
>>> XmlNode ccr = (XmlExtension)
>>> entry.FindExtension("ContinuityOfCareRecord", "urn:astm-org:CCR");
>>> if (ccr != null)
>>> {
>>
>>> System.Web.HttpContext.Current.Response.Write("<pre>");
>>> StringWriter sw = new StringWriter();
>>> XmlTextWriter xw = new XmlTextWriter(sw);
>>> xw.Formatting = Formatting.Indented;
>>> ccr.WriteTo(xw);
>>
>>> System
>>> .Web
>>> .HttpContext
>>> .Current.Response.Write(HttpUtility.HtmlEncode(sw.ToString()));
>>
>>> System.Web.HttpContext.Current.Response.Write("</pre>");
>>
>>> Console.WriteLine("ccr is not null");
>>> }
>>> }
>>> }
>>> catch (GDataRequestException err)
>>> {
>>> MessageBox.Show(err.ResponseString);
>>> }
>>> }
>>
>>> Thanks very much in advance for any help,
>>> Aidan.
>>
>>> ----- Original Message -----
>>> From: "Eric (Google)" <[email protected]>
>>> To: "Google Health Developers" <[email protected]
>>
>>> Sent: Tuesday, 3 March, 2009 01:02:16 GMT +00:00 GMT Britain,
>>> Ireland, Portugal
>>> Subject: [Google-Health-API] Re: GDataRequestException in .Net
>>
>>> See the sample app for some hints:
>>> http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/
>>> ...
>>
>>> Eric
>>
>>> On Mar 2, 4:13 am, Aidan P Calnan
>>> <[email protected]> wrote:
>>>> Thanks Eric,
>>
>>>> I have replaced //service.Insert(new
>>>> Uri("https://www.google.com/h9/feeds/register/default
>>>> "), newNotice);
>>>> with service.Insert(new
>>>> Uri("https://www.google.com/h9/feeds/register/ui/profileID
>>>> "), newNotice);
>>>> in my code and i am getting the same exceptions. I know i have to
>>>> get the profile ID for a particular user by querying the profile/
>>>> list feed but I am unsure of how and where to do this in my code.
>>>> Thanks again in advance for any help.
>>
>>>> Thanks,
>>>> Aidan.
>>
>>>> ----- Original Message -----
>>>> From: "Eric (Google)" <[email protected]>
>>>> To: "Google Health Developers" <[email protected]
>>
>> ...
>>
>> read more ยป
>
>
> --------------------------------------------------------------------------
> Ta an r-phost seo fe reir an tseanta / na seanta seo leanas ata le
> fail ag
> This e-mail is subject to the following disclaimer(s) available at
>
> http://www.ittralee.ie/EmailDisclaimer.html
>
> Smaoinigh ar an dtimpeallacht sula bpriontaileann tu an r-phost seo
> Please consider the environment before printing this e-mail
> --------------------------------------------------------------------------
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---