Hello Aniket,

Please try this code.

// Add
URL modifiedFeedUrl = new URL("https://www.google.com/m8/feeds/
contacts/"+mydomain+"/full");

// Mod
Query query = new Query(modifiedFeedUrl);

// Add
query.addCustomParameter(new
Query.CustomParameter("xoauth_requestor_id", user.getEmailAddress()));

query.setMaxResults(200);
query.setStartIndex(index);
resultFeed = myService.query(query, ContactFeed.class);

--
imai

On 7月5日, 午後5:46, Aniket Ghode <[email protected]> wrote:
> Hi All,
>
> I'm trying to retrieve domain shared contacts using 2-legged oauth in Google
> marketplace application.
>
> I'm using following code,
>
>                 URL feedUrl = new
> URL("https://www.google.com/m8/feeds/contacts/"+
> mydomain+"/full?xoauth_requestor_id="+user.getEmailAddress());
>
> and even if I remove xoauth_requestor_id from URL, I'm getting same result.
>
>                 ContactsService myService = new
> ContactsService(Constants.APPLICATION_NAME);
>  String consumerKey = Constants.CONSUMER_KEY;
>         String consumerSecret = Constants.CONSUMER_SECRET;
>
>         GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
>         oauthParameters.setOAuthConsumerKey(consumerKey);
>         oauthParameters.setOAuthConsumerSecret(consumerSecret);
> oauthParameters.setOAuthType(OAuthType.TWO_LEGGED_OAUTH);
>         oauthParameters.setScope("https://www.google.com/m8/feeds/";);
>
>         myService.setOAuthCredentials(oauthParameters, new
> OAuthHmacSha1Signer());
>  myService.setConnectTimeout(10000);
> myService.setReadTimeout(10000);
> Query query = new Query(feedUrl);
>
> query.setMaxResults(200);
> query.setStartIndex(index);
>  resultFeed = myService.query(query, ContactFeed.class);
>
> But I'm getting java.lang.NullPointerException: No authentication header
> information.
>
> Please provide me with some solution to rectify the problem,
>
> Thanks,
> Aniket

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