public ContactFeed retrieveContacts(ContactsService service,
Credential credential) throws Exception {
URL url = new URL("https://www.google.com/m8/feeds/profiles/domain/my.domain.com/full");
service.setOAuth2Credentials(credential);
service.useSsl();
service.setHeader("GData-Version", "3.0");
ContactFeed contactFeed = new ContactFeed();
do {
ContactFeed feedResult = service.getFeed(url, ContactFeed.class);
contactFeed.getEntries().addAll(feedResult.getEntries());
if (feedResult.getNextLink() != null && feedResult.getNextLink().getHref() != null
&& !feedResult.getNextLink().getHref().isEmpty()) {
url = new URL(feedResult.getNextLink().getHref());
} else {
url = null;
}
} while (url != null);
return contactFeed;
}
This is my code for getting profiles. When executing this line
ContactFeed feedResult = service.getFeed(query, ContactFeed.class);
It will give java.lang.NullPointerException: missing header information .
Google, Google , Google Apps Provisioning, Google OAuth2. Google Apps OAuth2 java.lang.NullPointerException: . , , ? , , - AccessToken . , ? Cron Job, OAuth2.
====
Edit:
set header :
service.setHeader("GData-Version", "3.0");
service.setUserCredentials(myusername, mypassword);
. service.setOAuth2Credentials(), , .