'opensocial.Container.get()' is null or not an object

4 views
Skip to first unread message

kennyjay

unread,
May 19, 2008, 3:05:31 PM5/19/08
to Orkut Developer Forum
Hi All

I'm just diving into Orkut development and I'm just trying to get a
basic datarequest working and adding just this line causes a
javascript error to be thrown at runtime:

var req = opensocial.newDataRequest();

It refers to line 359 which is the generated code:

opensocial.newDataRequest=function(){return
opensocial.Container.get().newDataRequest()
};

Am I missing something real basic like a "Require Feature" parameter?

Thanks!

Ken

kennyjay

unread,
May 19, 2008, 4:15:43 PM5/19/08
to Orkut Developer Forum
A bit of a followup. I just added this simple add to my sandbox to
test the basic request functionality. It ran first time just fine,
then subsequently I re-added the same app and now am getting the same
javascript error as above! Now, I can't get it to work no matter how
hard I try.

This appears to be some kind of environment issue..

Here's the app:

<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="hello world example">
<Require feature="opensocial-0.7"/>
</ModulePrefs>


<Content type="html"><![CDATA[
<div id='main'>
<div id='test'> </div>
</div>
<script>
function setRequest() {
var data = {
html : "USER Input"


}


var req = opensocial.newDataRequest();
req.add(req.newUpdatePersonAppDataRequest(
opensocial.DataRequest.PersonId.VIEWER,
"test",
gadgets.json.stringify(data)),
"setData");
req.send(getRequest);


}


function getRequest() {
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(
opensocial.DataRequest.PersonId.VIEWER),
"getViewer");
req.add(req.newFetchPersonAppDataRequest(
opensocial.DataRequest.PersonId.VIEWER,
"test"),
"getData");
req.send(getResponse);

}


function getResponse(data) {
var viewer = data.get("getViewer").getData();
var testData = data.get("getData").getData()[viewer.getId()]["test"];

var unescapedTestData = gadgets.util.unescapeString(testData);
var testObject = gadgets.json.parse(unescapedTestData);

document.getElementById("test").innerHTML = testObject.html;


}


</script>
<script>
gadgets.util.registerOnLoadHandler(setRequest);
</script>
]]></Content>
</Module>

chris

unread,
May 22, 2008, 1:44:16 PM5/22/08
to Orkut Developer Forum
Ken,
Thanks for posting to my thread. My widget is a little different, I
have the Content Type defined as URL. Which I believe maybe my
problem. I think when you have the Content Type defined as URL, then
any calls to opensocial will fail since the opensocial javascript
library exists on a different server then the one defined within the
URL. And (as far as I can see) I don't see any references to the
opensocial javascript file in my generated code.

So I'm wondering if there is a way around this. I highly doubt
that I'm the only person who is attempting to create an OpenSocial
Widget using GWT, so I'm very curious to see how others have been able
to call the opensocial API from their GWT code.

I did read somewhere that someone was working on an OpenSocial
"connector" for GWT, but I haven't seen anything regarding that expect
for one post on www.ongwt.com (at least I believe that was the
website)

Anyway,.. I'll continue to experiment.
Thanks,
Chris

Rohit Ghatol

unread,
May 23, 2008, 4:33:11 PM5/23/08
to Orkut Developer Forum
Hi Chris,

There is some work going on the GWT front for OpenSocial.
You should keep a watch on the OpenSocial blogspot for updates on
this.
http://opensocialapis.blogspot.com/

Best,
Rohit
> for one post onwww.ongwt.com(at least I believe that was the

Jason

unread,
May 23, 2008, 5:34:34 PM5/23/08
to Orkut Developer Forum
Hi kenny. I've examined your code, and it seems fine aside from your
first couple of div elements (the 'id' attribute of both should be
contained within double quotes instead of single quotes). That
shouldn't cause the error you're seeing. For what it's worth, I'm able
to run it on my end without any errors.

Can you provide the URL to your profile with the application
installed? You can send it to me privately if you'd prefer. Also, can
you specify your city/country and the frequency of the error (e.g.
100%, 50%, etc.). Thanks.

- Jason

kennyjay

unread,
May 27, 2008, 2:11:36 PM5/27/08
to Orkut Developer Forum
Thanks for looking at this, Jason

I have two applications that utilize MakeRequest functionality and
both exhibited the same behaviour. Both are working this morning,
but only after I deleted and re-imported the apps. I'll post again if
they break.

Regards

Ken
> > > Ken- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages