I am working on Google App Engine. I want to retrieve & display User's
contacts. I wrote following code in Java
import com.google.gdata.client.*;
import com.google.gdata.client.contacts.*;
import com.google.gdata.client.http.AuthSubUtil;
import com.google.gdata.data.*;
import com.google.gdata.data.contacts.*;
import com.google.gdata.data.contacts.ContactEntry;
import com.google.gdata.data.contacts.ContactFeed;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
import java.io.IOException;
import java.net.MalformedURLException;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
public static List<UserContact> getGoogleContacts(String googleToken)
throws MalformedURLException, IOException, GeneralSecurityException,
ServiceException, AuthenticationException
{
String token = AuthSubUtil.getTokenFromReply(googleToken);
String sessionToken = AuthSubUtil.exchangeForSessionToken(token,
null);
ContactsService service = new ContactsService("Google-To Do-1");
service.setAuthSubToken(sessionToken, null);
URL feedUrl = new
URL("https://www.google.com/m8/feeds/contacts/default/full");
ContactFeed cf = service.getFeed(feedUrl, ContactFeed.class);
List<UserContact> lstUC = new ArrayList<UserContact>();
UserContact uC;
for (ContactEntry ce : cf.getEntries()) {
//System.out.print(ce.toString());
List<Email> lEmail = ce.getEmailAddresses();
for (Email em : lEmail) {
uC = new
UserContact(em.getAddress().toString(),ce.getName().toString());
//lEmails.add(em.getAddress());
lstUC.add(uC);
}
}
return lstUC;
}
When I deploy application I am getting following error:
class file for com.google.gdata.util.ServiceException not found
class file for com.google.gdata.util.AuthenticationException not found
String googleToken;
googleToken = request.getParameter("token");
List<UserContact> lstUC = UserFunctions.getGoogleContacts(googleToken);
Expected output:
It will not give any error, I attached jar gdata-core1.0.jar in eclipse
workspace.
I am not able to solve.
Thanks in advance.
Thanks & Regards,
Devang Modi.
--
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" 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://code.google.com/apis/contacts/community/forum.html