Same Problem Error 401

1 view
Skip to first unread message

Alabê Duarte

unread,
Oct 22, 2009, 10:45:55 PM10/22/09
to opensocial-client-libraries
I also hinted the same problem, suddenly this error started to occur

my app don't work

java.io.IOException: Container returned status 401 "Server returned
HTTP response code: 401 for URL:
http://sandbox.orkut.com/social/rpc?oauth_signature=OyNqFxik0pIFTLtDmm9jyVlcMkk%3D&oauth_version=1.0&oauth_nonce=2695759693201&oauth_body_hash=DXcWveBSx5z1Ac%2BRnI0aD8dyfRk%3D&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=orkut.com%3A623061448914&xoauth_requestor_id=01619632904447877131&oauth_timestamp=1256262043"
at org.opensocial.client.OpenSocialHttpClient.send
(OpenSocialHttpClient.java:118)
at org.opensocial.client.OpenSocialHttpClient.execute
(OpenSocialHttpClient.java:70)
at org.opensocial.client.OpenSocialBatch.submitRpc
(OpenSocialBatch.java:142)
at org.opensocial.client.OpenSocialBatch.send(OpenSocialBatch.java:
102)
at org.opensocial.client.OpenSocialClient.fetchPeople
(OpenSocialClient.java:440)
at org.opensocial.client.OpenSocialClient.fetchPerson
(OpenSocialClient.java:146)
at org.opensocial.client.OpenSocialClient.fetchPerson
(OpenSocialClient.java:140)

best regards,

Alabê Duarte

Jason (Google)

unread,
Oct 23, 2009, 1:05:21 PM10/23/09
to opensocial-cl...@googlegroups.com
Can you post the debug output? I'd like to see what's being sent in the request body. Also, are you using the library from trunk or the 20090402 package?

- Jason

Alabê Duarte

unread,
Oct 24, 2009, 2:41:34 PM10/24/09
to opensocial-cl...@googlegroups.com
yes, I am using this package follows below the source code and the error log:





import java.util.Collection;

import org.opensocial.client.OpenSocialClient;
import org.opensocial.data.OpenSocialField;
import org.opensocial.data.OpenSocialPerson;

public class DisplayFriends {

    public static void main(String[] args) {
        OpenSocialClient c = new OpenSocialClient("orkut.com");

        // orkut supports both the REST and RPC protocols; RPC is preferred
        // because
        // RPC supports batch requests
        c.setProperty(OpenSocialClient.Property.RPC_ENDPOINT,
                "http://sandbox.orkut.com/social/rpc");

        // Credentials provided here are associated with the gadget located at
        // http://opensocial-resources.googlecode.com/svn/samples/rest_rpc/sample.xml;
        // If you install this gadget, you can substitute your own OpenSocial ID
        // for the one used below and fetch your profile data and friends
        c.setProperty(OpenSocialClient.Property.CONSUMER_SECRET,
                "uynAeXiWTisflWX99KU1D2q5");
        c.setProperty(OpenSocialClient.Property.CONSUMER_KEY,
                "orkut.com:623061448914");
        c.setProperty(OpenSocialClient.Property.VIEWER_ID,
                "10886451842774632785");

        try {
            // Retrieve the friends of the specified user using the
            // OpenSocialClient
            // method fetchFriends
            Collection<OpenSocialPerson> friends = c.fetchFriends();

            System.out.println("----------");

            // The fetchFriends method returns a typical Java Collection object
            // with
            // all of the methods you're already accustomed to like size()
            System.out.println(friends.size() + " friends:");

            // Iterate through the Collection
            for (OpenSocialPerson friend : friends) {
                // Output the name of the current friend
                System.out.println("Nickname: " + friend.getDisplayName());
                System.out.println("Id: " + friend.getId());
                
                for (int i = 0; i < friend.fieldNames().length; i++) {
                    System.out.println("field: " + friend.fieldNames()[i]);
                }

                if (friend.hasField("GENDER")) {
                    // valor de um campo texto simples
                    System.out.println("Gênero: "
                            + friend.getField("GENDER").getStringValue());
                }
                if (friend.hasField("AGE")) {
                    // valor de um campo texto simples
                    System.out.println("Idade: "
                            + friend.getField("AGE").getStringValue());
                }

                OpenSocialField thumbnailUrlField = friend
                        .getField("thumbnailUrl");
                if (!thumbnailUrlField.isComplex()) {
                    System.out.println("Thumbnail URL: "
                            + thumbnailUrlField.getStringValue());
                }

                System.out.println("\n\n");
                
            }

            System.out.println("----------");

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

}


java.io.IOException: Container returned status 401 "Server returned HTTP response code: 401 for URL: http://sandbox.orkut.com/social/rpc?oauth_signature=mXPYI1tzfd9B8kcHQJHvW3XxGaM%3D&oauth_version=1.0&oauth_nonce=20728804852292&oauth_body_hash=JmpDugInC8NzAbJUc%2BY1p5rR3as%3D&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=orkut.com%3A623061448914&xoauth_requestor_id=10886451842774632785&oauth_timestamp=1256405845"
    at org.opensocial.client.OpenSocialHttpClient.send(OpenSocialHttpClient.java:118)
    at org.opensocial.client.OpenSocialHttpClient.execute(OpenSocialHttpClient.java:70)
    at org.opensocial.client.OpenSocialBatch.submitRpc(OpenSocialBatch.java:142)

    at org.opensocial.client.OpenSocialBatch.send(OpenSocialBatch.java:102)
    at org.opensocial.client.OpenSocialClient.fetchPeople(OpenSocialClient.java:440)
    at org.opensocial.client.OpenSocialClient.fetchFriends(OpenSocialClient.java:190)
    at org.opensocial.client.OpenSocialClient.fetchFriends(OpenSocialClient.java:184)
    at org.opensocial.client.OpenSocialClient.fetchFriends(OpenSocialClient.java:162)
    at com.OpenSocial.DisplayFriends.main(DisplayFriends.java:49)

best regards, Alabê Duarte


Reply all
Reply to author
Forward
0 new messages