Team,

I am using the following code (at the bottom of post) in in GWT ..
access all users from the a given googlepps domain.
I keep getting the this error

- error -

Initializing App Engine server
Nov 17, 2011 4:15:32 AM com.google.apphosting.utils.jetty.JettyLogger
info
INFO: Logging to JettyLogger(null) via
com.google.apphosting.utils.jetty.JettyLogger
Nov 17, 2011 4:15:32 AM
com.google.apphosting.utils.config.AppEngineWebXmlReader
readAppEngineWebXml
INFO: Successfully processed C:\development\n5fix\n6\war\WEB-INF/
appengine-web.xml
Nov 17, 2011 4:15:32 AM
com.google.apphosting.utils.config.AbstractConfigXmlReader
readConfigXml
INFO: Successfully processed C:\development\n5fix\n6\war\WEB-INF/
web.xml
Nov 16, 2011 11:15:35 PM
com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at http://localhost:8888/
Nov 16, 2011 11:16:00 PM
com.google.appengine.repackaged.org.apache.http.impl.client.DefaultRequestDirector
handleResponse
WARNING: Authentication error: Unable to respond to any of these
challenges: {googlelogin=WWW-Authenticate: GoogleLogin realm="http://
www.google.com/accounts/ClientLogin", service="apps"}



note: consumer key and secret  .. provided globally,

- code -
public List<UserInfo> GetAllUserForDomain(String domain) {
                List<UserInfo> userlst = null;
                UserInfo u;

                try {
                        LOGGER.log(Level.INFO, "Get all user in domain  - " + 
domain);
                        this.domain = domain; // set global value

                        // Credential set the oAuth to accomodate the app market
                        GoogleOAuthParameters oauthParameters = new
GoogleOAuthParameters();
                        oauthParameters.setOAuthConsumerKey(consumerKey);
                        oauthParameters.setOAuthConsumerSecret(consumerSecret);

                        // Create a new Apps Provisioning service
                        UserService myService = new UserService("n6");

                        myService.setOAuthCredentials(oauthParameters,new
OAuthHmacSha1Signer());

                        URL metafeedUrl = new 
URL("https://www.google.com/a/feeds/"+ domain
+ "/user/2.0");

                        LOGGER.log(Level.INFO, "Getting user entries...\n");

                        List<UserEntry> entries = new ArrayList<UserEntry>();

                        while (metafeedUrl != null) {
                                // Fetch page
                                UserFeed resultFeed =
myService.getFeed(metafeedUrl,UserFeed.class);
                                entries.addAll(resultFeed.getEntries());
                                // Check for next page
                                Link nextLink = resultFeed.getNextLink();
                                if (nextLink == null) {
                                        metafeedUrl = null;
                                } else {
                                        // metafeedUrl = nextLink.getHref();
                                }
                        }

                        userlst = new ArrayList<UserInfo>();
                        // Handle results
                        for (int i = 0; i < entries.size(); i++) {
                                UserEntry entry = entries.get(i);
                                u = new UserInfo(); // initialize serinfo
                                entry.getLogin();
                                u.setLastName(entry.getName().getFamilyName());
                                u.setFirstName(entry.getName().getGivenName());
                                u.setUsername(entry.getLogin().getUserName());
                                if (entry.getEmail() != null)
                                        u.setEmail(entry.getEmail().toString());
                                userlst.add(u);
                                // userlst.add(entry.getTitle().getPlainText());
                                LOGGER.log(Level.INFO, "\t" + 
entry.getTitle().getPlainText());
                        }
                        // ystem.out.println("\nTotal Entries: 
"+entries.size());
                        LOGGER.log(Level.INFO, "\nTotal Entries: " + 
entries.size());

                } catch (Exception e) {
                        e.getLocalizedMessage();
                }

                return userlst;

        }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to