Hi All,

I am trying to access contacts using gdata client library.when i am
trying to access the contacts i am facing following exception

java.lang.NullPointerException: No authentication header information
        
com.google.gdata.util.AuthenticationException.initFromAuthHeader(AuthenticationException.java:
96)
        
com.google.gdata.util.AuthenticationException.<init>(AuthenticationException.java:
67)
        
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:
600)
        
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:
563)
        
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:
552)
        
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:
530)
        
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:
535)
        com.google.gdata.client.Service.getFeed(Service.java:1135)
        com.google.gdata.client.Service.getFeed(Service.java:998)
        com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631)
        com.google.gdata.client.Service.getFeed(Service.java:1017)
        com.raisonne.oauth.CallBackAction.execute(CallBackAction.java:62)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


Hers is the client code i have written to communicate with the service

GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();

                         oauthParameters.setOAuthConsumerKey("xyz");

                         oauthParameters.setOAuthConsumerSecret("secret");
                            GoogleOAuthHelper oauthHelper = new 
GoogleOAuthHelper(new
OAuthHmacSha1Signer());
                        oauthParameters.setScope(SCOPE);
                        oauthParameters.setOAuthVerifier(oauth_verifier);
                        oauthParameters.setOAuthToken(oauth_token);
        
oauthParameters.setOAuthTokenSecret(session.get("oauth_token_secret").toString());
                        String token = 
oauthHelper.getAccessToken(oauthParameters);
                        ContactsService  client=new ContactsService 
("mydemoapp");
                        client.setOAuthCredentials(oauthParameters, new
OAuthHmacSha1Signer());
                        URL feedUrl = new URL("http://www.google.com/m8/feeds/
contacts/default/base");
                        ContactFeed resultFeed = client.getFeed(feedUrl,
ContactFeed.class);

                        for (int i = 0; i < resultFeed.getEntries().size(); 
i++) {
                            ContactEntry entry = (ContactEntry)
resultFeed.getEntries().get(i);
                            System.out.println("|\t" + (i + 1) + ": "
                                + entry.getTitle().getPlainText());
                          }

i am getting this exception at this line

ContactFeed resultFeed = client.getFeed(feedUrl, ContactFeed.class);

can any one help me to find out what exactly i am doing wrong?

thanks in advance

-- 
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

Reply via email to