NullPointerException in Response.getParser

43 views
Skip to first unread message

Jive Turkey

unread,
Jun 18, 2010, 9:42:16 PM6/18/10
to OpenSocial Client Libraries
After following the instructions in the Wiki, any attempts to contact
Orkut (either the sandbox or non-sandbox provider) give me:

java.lang.NullPointerException
at org.opensocial.Response.getParser(Response.java:90)
at org.opensocial.Response.parseRpcResponse(Response.java:53)
at org.opensocial.Client.submitRpc(Client.java:177)
at org.opensocial.Client.send(Client.java:146)
at org.opensocial.Client.send(Client.java:108)
at OrkutTest.main(OrkutTest.java:31)

I believe this is due to a null response, possibly from 401 being
returned from the server. I've tried 2 different consumer keys (with
and without a Gadget), 2-legged OAuth, 3-legged OAuth and pretty much
anything else I could think of.

Any suggestions on where/how to proceed?

Thanks.

Jason (Google)

unread,
Jun 19, 2010, 8:32:35 PM6/19/10
to opensocial-cl...@googlegroups.com
I was seeing the same thing when running test/org/opensocial/online/PeopleTest.java using the ID provided, but when I swapped out the ID with another that did have the gadget installed, everything worked. In that case, the issue was caused by a 403 response from the server because the gadget was no longer installed on the profile, and only using 2-legged OAuth -- 3-legged OAuth continued to work. It sounds like you're seeing a different cause.

Please help me by doing a few things:
[{"id":"key","error":{"message":"forbidden: Get profile permission denied.","data":{"errorType":"noPermissions"},"code":403}}]
  • Try running PeopleTest with ORKUT_ID set to "01495306580392390900" and verify that it works.
I'm going to get a patch in to the library soon that handles this kind of error a lot better. Hopefully, after the fix is in, it will be much more apparent why a particular request fails without having to do too much digging.

- Jason


--
You received this message because you are subscribed to the Google Groups "OpenSocial Client Libraries" group.
To post to this group, send email to opensocial-cl...@googlegroups.com.
To unsubscribe from this group, send email to opensocial-client-l...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/opensocial-client-libraries?hl=en.


Jive Turkey

unread,
Jun 20, 2010, 12:52:57 PM6/20/10
to OpenSocial Client Libraries
Thanks Jason, PeopleTest does in fact work with the ORKUT_ID you
provided.

The 401 I was seeing I believe was from trying to use the google email
address instead of the Orkut OpenSocial numeric ID which I didn't
realize existed. I found a gadget that shows you the numeric
OpenSocial ID for Orkut, so I am able to obtain that ID number. Then,
I was able to get data from the PeopleService successfully using my
own key, secret, and open social ID.

However, now I would like to post an Activity from my server to
Orkut. Is this possible with 2-legged Auth, or does it require the 3-
legged mechanism? I noticed the included tests don't post an Activity
via Orkut (MySpace only). When I tried this:

Activity activity = new Activity();
activity.setTitle("I am an activity title.");
activity.setTitleId("test");
activity.setBody("I am an activity body.");
Request request2 = ActivitiesService.createActivity(activity);
Response response2 = client.send(request2);
Object o = response2.getEntry();
System.out.println(o.toString());

I got the following "Permission token validation failed", with a 403
return code. Logs are as follows:

http://sandbox.orkut.com/social/rpc?xoauth_requestor_id=17329722700454841612&oauth_body_hash=tIuCnRi88gSGPU41YwmZu4FwiwI%3D&oauth_consumer_key=orkut.com%3A382502921366&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1277052024&oauth_nonce=9385311928574&oauth_version=1.0&oauth_signature=GPY1PNYL4ZC1J3zjHwpHe47GkmI%3D
[{"id":"key","method":"activities.create","params":
{"groupId":"@self","appId":"@app","userId":"@me","activity":{"body":"I
am an activity body.","title":"I am an activity title."}}}]
200
[{"id":"key","error":{"message":"forbidden: Permission token
validation failed.","data":{"errorType":"noPermissions"},"code":403}}]

I did set all the available permissions on the gadget in my sandbox
account. I'm also a little unclear about how OpenSocial types
(Activity) for example maps to Orkut types ("Says" vs. "Scrap" etc).





On Jun 19, 8:32 pm, "Jason (Google)" <apija...@google.com> wrote:
> I was seeing the same thing when running
> test/org/opensocial/online/PeopleTest.java using the ID provided, but when I
> swapped out the ID with another that did have the gadget installed,
> everything worked. In that case, the issue was caused by a 403 response from
> the server because the gadget was no longer installed on the profile, and
> only using 2-legged OAuth -- 3-legged OAuth continued to work. It sounds
> like you're seeing a different cause.
>
> Please help me by doing a few things:
>
>    - Enable log output for your app by following the instructions at
>    http://code.google.com/p/opensocial-java-client/wiki/Debugging. If you
>    execute a simple RPC request with log output enabled, you should clearly see
>    the reason that the request is failing in the response, something like:
>
> [{"id":"key","error":{"message":"forbidden: Get profile permission
> denied.","data":{"errorType":"noPermissions"},"code":403}}]
>
>    - Try running PeopleTest with ORKUT_ID set to "01495306580392390900" and
> > opensocial-client-l...@googlegroups.com<opensocial-client- libraries%2Bunsu...@googlegroups.com>
> > .

Jason (Google)

unread,
Jun 20, 2010, 3:33:36 PM6/20/10
to opensocial-cl...@googlegroups.com
Thanks for the confirmation. I'll fix the NPE issue really soon since you shouldn't have to enable logging in order to see why a particular request is failing.

The last time I checked, orkut didn't support creating activities via the REST/RPC API, and the current protocol docs don't discuss activities. This could be the reason for the error.


- Jason

To unsubscribe from this group, send email to opensocial-client-l...@googlegroups.com.

Shlomo Rabinovitch

unread,
Jun 21, 2010, 8:31:17 AM6/21/10
to opensocial-cl...@googlegroups.com
I did registration to Orkut and got the access using OAuth2 scheme. No activity, no status, but still access, getting person, friends.
Now i'm trying to get access to Gmail, using opensocial. So i have registered in google, got the key and the secret. trying to use them together with person opensocial ID that i have used in Orkut access, getting exception:

java.lang.NullPointerException
        at org.opensocial.Response.getParser(Response.java:90)
        at org.opensocial.Response.parseRpcResponse(Response.java:53)
        at org.opensocial.Client.submitRpc(Client.java:177)
        at org.opensocial.Client.send(Client.java:146)
        at org.opensocial.Client.send(Client.java:108)



using the Orkut key and secret with the same Person opensocial ID getting to another response:

[{ "id": "key", "error": {  "message": "internalError: Invalid length for obfuscated ID 02594563404447123042",  "code": 500 }}]


as i explained in previous mail the operations are as follows:

        provider = new GoogleProvider();
        userScheme = new OAuth2LeggedScheme(OAuthConsumerKey, OAuthConsumerSecret, OSID);
        client = new Client(provider, userScheme);
        Response response =  client.send(request);
        Person viewer = response.getEntry();
        System.out.println ("<<<<<<<<<< " + viewer + " >>>>>>>>>>");


any help? why can't i get access to gmail? maybe some example?

Thanks

--
Shlomo
+972-52-5747475

Reply all
Reply to author
Forward
0 new messages