Can you post http request and response headers. Thanks, eric
On Mar 10, 8:49 am, hlr <[email protected]> wrote: > I get a profile ID of HiIV.6lzFB8. When I > go to do the feed for SCOPE + "profile/ui/" + firstProfileID. > I get nothing in the feed. > > Thoughts? > > Herb Rush - Code Below > > Feed profileListFeed = null; > List<Entry> entries = null; > try { > profileListFeed = h9Service.getFeed(new URL(SCOPE + "profile/list"), > Feed.class); > entries = profileListFeed.getEntries(); > } catch (Exception e) { > System.out.println("get profileListFeed problem = " + e.toString > ()); > throw new HealthSampleException("Bad profileListFeed", e); > } > > String firstProfileID = entries.get(0).getPlainTextContent(); > System.out.println("firstProfileID = " + firstProfileID); > //BUILD QUERY TO GET PROFILE > Query query = null; > StringBuffer sb = new StringBuffer(); > ProfileFeed profileFeed = null; > try { > profileFeed = h9Service.getFeed( new URL(SCOPE + "profile/ui/" + > firstProfileID), ProfileFeed.class); > for (ProfileEntry entry : profileFeed.getEntries()) { > > System.out.println(entry.getContinuityOfCareRecord().getXmlBlob > ().getBlob()); > String ws = prettifyXmlBlob(entry.getContinuityOfCareRecord > ().getXmlBlob()); > if(ws != null) { > sb = sb.append(ws); > } else { > sb = sb.append("[null xml blob]"); > } > } > } catch (Exception e) { > throw new HealthSampleException("Bad profile URL!", e); > } > > On Mar 10, 11:24 am, hlr <[email protected]> wrote: > > > Hi Eric, > > > I worked out the List<Entry> - I have not used that before. > > I am getting profile ID of HiIV.6lzFB8. Is that right? > > > I use printable names at google health. > > > Thanks > > > Herb Rush > > > On Mar 10, 8:12 am, hlr <[email protected]> wrote: > > > > Thanks Eric! > > > > A could of follow up questions: > > > > 1) the List<Entry> in the middle of the code segment is to be > > > disgarded- correct? > > > 2) Why is there a distinction between Servlets/applications and .jsp? > > > > Thanks > > > > Herb Rush > > > > On Mar 9, 6:53 pm, "Eric (Google)" <[email protected]> wrote: > > > > > Hi, > > > > > A couple of notes: > > > > > - You don't need the digest parameter when using > > > > the profile/list feed. Use that feed to obtain the > > > > id of the profile you'd like to work with. > > > > > - If you're using ClientLogin (username/password) authentication > > > > as the healthsample.java, you need to query the profile/ui feed, > > > > not the profile/default feed. If you're writing a .jsp page, > > > > then profile/default is the one you want :) > > > > > See:http://code.google.com/apis/health/docs/2.0/reference.html#Authentica... > > > > > -- > > > > A full ClientLogin sample on h9 would be: > > > > > String SCOPE = "https://www.google.com/h9/feeds/"; > > > > > H9Service service = new H9Service("yourCompany-YourApp-v1.0"); > > > > service.setUserCredentials("email", "password"); > > > > > Feed profileListFeed = service.getFeed(new URL(SCOPE + "profile/ > > > > list"), Feed.class); > > > > List<Entry> entries = profileListFeed.getEntries(); > > > > > String firstProfileID = entries.get(0).getPlainTextContent(); > > > > ProfileFeed profileFeed = service.getFeed( > > > > new URL(SCOPE + "profile/ui/" + firstProfileID), > > > > ProfileFeed.class); > > > > for (ProfileEntry entry : profileFeed.getEntries()) { > > > > System.out.println(entry.getContinuityOfCareRecord().getXmlBlob > > > > ().getBlob()); > > > > > } > > > > > Cheers, > > > > Eric > > > > > On Mar 9, 1:14 pm, hlr <[email protected]> wrote: > > > > > > This is the healthsample.java code with a few modifications. It goes > > > > > to the point > > > > > were it sets up the feed to read profile data. The entries in the > > > > > feed seem to be null. > > > > > > Any Suggestions? > > > > > > I have added the code below (in case I have shot myself in the foot). > > > > > > Thanks > > > > > > Herb Rush > > > > > > //BUILD QUERY TO GET PROFILE > > > > > Query query = null; > > > > > try { > > > > > String url1 = new String("https://www.google.com/h9/ > > > > > feeds/profile/default"); > > > > > String url2 = new > > > > > String("https://www.google.com/health/feeds/profile/ > > > > > default"); > > > > > String url3 = new > > > > > String("https://www.google.com/h9/feeds/profile/ > > > > > list"); > > > > > query = new Query(new URL(url3)); > > > > > query.addCustomParameter(new Query.CustomParameter("digest", > > > > > "true")); > > > > > } catch (MalformedURLException e) { > > > > > throw new HealthSampleException("Bad profile URL!", e); > > > > > } > > > > > > //SET UP THE FEED TO PROCESS RESULTS > > > > > Feed result = null; > > > > > try { > > > > > result = h9Service.getFeed(query, Feed.class); > > > > > } catch (Exception e) { > > > > > throw new HealthSampleException("Error retrieving profile", > > > > > e); > > > > > } > > > > > > StringBuffer sb = new StringBuffer(); > > > > > try { > > > > > if(result != null) { > > > > > System.out.println("Query result not null - thats good"); > > > > > } > > > > > // We used the digest=true parameter, so there should only > > > > > // be a single Atom entry that contains all of the CCR data in > > > > > profile. > > > > > for (Entry entry : result.getEntries()) { > > > > > System.out.println(entry.getXmlBlob().getBlob()); > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
