Hi Max, I could resolve the problem. Actually there was some error with the server startup. No w am perfectly fine. Thanks a ton..
Regards and Wishes, Rajashree On Sat, Nov 28, 2009 at 8:57 AM, MaxDrive <[email protected]> wrote: > Did you try to debug and know where exactly it happened? at what point > the exception occurs? > > On Fri, Nov 27, 2009 at 7:30 PM, rajashree baradur > <[email protected]> wrote: > > Hi Max, > > Oops Sorry! I was not knowing that you are coding in .net. I am getting a > > "google.serviceException" error. > > > > On Fri, Nov 27, 2009 at 7:34 AM, MaxDrive <[email protected]> wrote: > >> > >> Hi Raj, > >> > >> I'm using .net not java and i see method names in the GH library your > >> using which is different from .net but i'm guessing it's the same > >> purpose. Can you tell me exactly the error or what happened when you > >> run this code and we'll start from there. > >> > >> On Fri, Nov 27, 2009 at 12:47 AM, rajashree baradur > >> <[email protected]> wrote: > >> > Hi Max, > >> > Can you please look at my code and tell me where am going wrong? > >> > Connect.java: > >> > package health; > >> > import java.io.IOException; > >> > import java.net.MalformedURLException; > >> > import java.net.URL; > >> > import java.util.ArrayList; > >> > import java.util.Calendar; > >> > import java.util.GregorianCalendar; > >> > import java.util.List; > >> > import com.google.gdata.client.Query; > >> > import com.google.gdata.client.health.HealthService; > >> > import com.google.gdata.data.Entry; > >> > import com.google.gdata.data.Feed; > >> > import com.google.gdata.data.TextContent; > >> > import com.google.gdata.data.health.ProfileEntry; > >> > import com.google.gdata.data.health.ProfileFeed; > >> > import com.google.gdata.data.health.RegisterFeed; > >> > import com.google.gdata.util.ServiceException; > >> > public class Connect{ > >> > @SuppressWarnings("unused") > >> > private static int idNum = 0; > >> > @SuppressWarnings("unused") > >> > private static final String PREFIX = "WPI Neuro"; > >> > private static final String VERSION = "alpha"; > >> > private List<String> profileIds = null; > >> > @SuppressWarnings("unused") > >> > private RegisterFeed feed; > >> > private HealthService service1; > >> > private Calendar dateOfBirth = null; > >> > private static final String CCR_URL = > >> > "https://www.google.com/health/feeds/profile/ui/"; > >> > private static final String FEED_BASE_PATH = > >> > "http://www.google.com/health/feeds/"; > >> > private static final String PROFILE_FEED_PATH = FEED_BASE_PATH + > >> > "profile/"; > >> > private static final String REGISTER_FEED_PATH = FEED_BASE_PATH + > >> > "register/"; > >> > private static final String PROFILE_LIST_URL_PATH = PROFILE_FEED_PATH > + > >> > "list"; > >> > /** > >> > * Creates a new instance with a given user name and password > >> > * > >> > * @param user username > >> > * @param pass password > >> > */ > >> > public Connect(String username, String password) > >> > throws MalformedURLException, IOException, ServiceException > >> > { > >> > //Of the form [company-id]-[app-name]-[app-version] > >> > String appName = "WPI-Total Neuro Placement-" + VERSION; > >> > service1 = new HealthService(appName); > >> > service1.setUserCredentials(username, password); > >> > refeed(); > >> > } > >> > /** > >> > * Refreshes notices > >> > */ > >> > private void refeed() throws IOException, ServiceException, > >> > MalformedURLException > >> > { > >> > if (profileIds == null) { > >> > > >> > profileIds = new ArrayList<String>(); > >> > Feed profileListFeed = service1.getFeed( > >> > new URL(PROFILE_LIST_URL_PATH), Feed.class); > >> > for (Entry profileListEntry : profileListFeed.getEntries()) { > >> > profileIds.add( > >> > ((TextContent) profileListEntry.getContent()). > >> > getContent().getPlainText()); > >> > //System.out.println(((TextContent) profileListEntry.getContent()). > >> > // getContent().getPlainText()); > >> > } > >> > } > >> > feed = service1.getFeed( > >> > new URL(REGISTER_FEED_PATH + "ui/" + profileIds.get(0)), > >> > RegisterFeed.class); > >> > dateOfBirth = refreshDob(); > >> > } > >> > private Calendar refreshDob() { > >> > Query query; > >> > ProfileFeed result; > >> > try { > >> > query = new Query(new URL(CCR_URL + profileIds.get(0))); > >> > query.addCustomParameter(new Query.CustomParameter("digest", "true")); > >> > result = service1.getFeed(query, ProfileFeed.class); > >> > } catch (MalformedURLException e) { > >> > return null; > >> > } catch (ServiceException e) { > >> > return null; > >> > } catch (IOException e) { > >> > return null; > >> > } > >> > List<ProfileEntry> entries = result.getEntries(); > >> > // 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 (ProfileEntry entry : entries) > >> > { > >> > /* > >> > * Look for the hierarchy: > >> > * <Actors>...<Person>...<DateOfBirth>...<ExactDateTime> > >> > * It contains the time of birth in the format CCYY-MM-DDThh:mm:ssZ > >> > */ > >> > int read = 0; > >> > String profile = > >> > entry.getContinuityOfCareRecord().getXmlBlob().getBlob(); > >> > read = profile.indexOf("<Actors>", read); > >> > if(read == -1) > >> > { > >> > break; > >> > } > >> > read = profile.indexOf("<Actor>", read); > >> > if(read == -1) > >> > { > >> > break; > >> > } > >> > read = profile.indexOf("<Person>", read); > >> > if(read == -1) > >> > { > >> > break; > >> > } > >> > read = profile.indexOf("<DateOfBirth>", read); > >> > if(read == -1) > >> > { > >> > break; > >> > } > >> > read = profile.indexOf("<ExactDateTime>", read); > >> > if(read == -1) > >> > { > >> > break; > >> > } > >> > read += "<ExactDateTime>".length(); > >> > String date = profile.substring(read, read + 10); //Date datum > >> > int day, month, year; > >> > year = Integer.parseInt(date.substring(0,4)); > >> > month = Integer.parseInt(date.substring(5,7)); > >> > day = Integer.parseInt(date.substring(8,10)); > >> > Calendar birth = new GregorianCalendar(year, month, day); > >> > return birth; > >> > } > >> > return null; > >> > } > >> > /** > >> > * Returns the date of birth of the holder of the profile > >> > * @return the date of birth to the day or null if it could not be > >> > retrieved > >> > */ > >> > public Calendar getDoB() > >> > { > >> > return dateOfBirth; > >> > } > >> > } > >> > > >> > Regards and Wishes, > >> > Rajashree > >> > > >> > > >> > -- > >> > > >> > 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]<googlehealthdevelopers%[email protected]> > . > >> > For more options, visit this group at > >> > http://groups.google.com/group/googlehealthdevelopers?hl=en. > >> > > >> > >> > >> > >> -- > >> Emmanuel F. Caulin > >> Makati City, Philippines > >> > >> -- > >> > >> 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]<googlehealthdevelopers%[email protected]> > . > >> For more options, visit this group at > >> http://groups.google.com/group/googlehealthdevelopers?hl=en. > >> > >> > > > > > > > > -- > > Love & Live, Life is short.. > > Always.... > > Raj.... > > > > -- > > > > 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]<googlehealthdevelopers%[email protected]> > . > > For more options, visit this group at > > http://groups.google.com/group/googlehealthdevelopers?hl=en. > > > > > > -- > Emmanuel F. Caulin > Makati City, Philippines > > -- > > 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]<googlehealthdevelopers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/googlehealthdevelopers?hl=en. > > > -- 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.
