Bug in gadgets.io.makeRequest(url, populateWeatherinfo, params) ??

3 views
Skip to first unread message

NITIN KISHEN

unread,
Jul 11, 2008, 9:20:36 AM7/11/08
to opensoc...@googlegroups.com
Hi all,
I'm trying to use the Google weather API, but am stuck up with it.

The gadgets.io.makeRequest(url, populateWeatherinfo, params)  works well when the city name doesnt have a space   in it. However for eg. i have the city san jose and try to call the weather API(to get the XML response) using the gadgets.io.makeRequest(url, populateWeatherinfo, params) it's throwing an unusual pop-up saying that 'several java machines running the same process caused an error'.
I googled this and there were many explanations, but i donot understand how this can come up here. Moreover if i call the weather API with cities not having space in bertwwen them, it works perfectly.
I debugged thee JS and found that this pop-up comes up in the js file dynamic-height.js right after the line: xhr.open(method,proxyUrl,true);
I'm copying the entire function here:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function makeXhrRequest(realUrl,proxyUrl,callback,paramData,method,params,processResponseFunction,opt_contentType){var xhr=makeXhr();
xhr.open(method,proxyUrl,true);
if(callback){xhr.onreadystatechange=gadgets.util.makeClosure(null,processResponseFunction,realUrl,callback,params,xhr)
}if(paramData!=null){xhr.setRequestHeader("Content-Type",opt_contentType||"application/x-www-form-urlencoded");
xhr.send(paramData)
}else{xhr.send(null)
}}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you use firebug the exact line number is 321.
Is this a bug or am i missing something here??

Thanks,
Nitin


openSocialAPIerror.JPG

Arne Roomann-Kurrik (Google)

unread,
Jul 11, 2008, 7:26:17 PM7/11/08
to OpenSocial - OpenSocial Application Development
Can you list or give a link to the code that is causing this error?

Thanks
~Arne
>  openSocialAPIerror.JPG
> 162KViewDownload

nitinkcv

unread,
Jul 12, 2008, 3:16:07 AM7/12/08
to OpenSocial - OpenSocial Application Development
Hi,

The xml link to my app is at
http://hosting.gmodules.com/ig/gadgets/file/108449361619403857802/weatherwatcher_35_3.xml.
Please note that only if we go to the debugging mode in firebug we get
the pop-up error. In normal run mode we would get an error message in
the console of firebug.

The usual error message we get is something like
http://ip7llrq72et7pb06751p5ur3bc9dbmh4.sandbox.orkut.gmodules.com/gadgets/makeRequest?refresh=3600&url=http%3A%2F%2Fwww.google.com%2Fig%2Fapi%3Fweather%3Dsan%20jose&httpMethod=GET&headers=&postData=&authz=&st=&contentType=DOM&numEntries=3&getSummaries=false&signOwner=true&signViewer=true&gadget=http%3A%2F%2Fhosting.gmodules.com%2Fig%2Fgadgets%2Ffile%2F108449361619403857802%2Fweatherwatcher_35_2.xml&bypassSpecCache=
and then i would get the message that my XML has no properties.

Please follow the following steps:
1) First on load of the App weather info reg w.r.t a city is
preloaded.
2) Next please enter a cityname which doesn't have a space in between.
say like 'California'
3) You would see that the weather info reg 'California' is loaded up
in the page.
4) Next please enter a cityname which has a space in it. say ' New
York'.
5) You would immediately see error message in the console of firebug.
6) However if you would debug the application with firebug and put
breakpoints in the file dynamic-height.js at line number
321 (xhr.open(method,proxyUrl,true);) and on stepping over that
line in firebug we would get that pop-up error saying that
'several java machines running the same process caused an error'.

Please note that this problem comes only if we put a cityname which
has a space in it. Strange isn't it!!

Please let me know if you require more clarity.

Thanks,
Ntin

nitinkcv

unread,
Jul 12, 2008, 4:26:49 AM7/12/08
to OpenSocial - OpenSocial Application Development
Hi,

Just an update in this error is in this thread also
http://groups.google.com/group/opensocial-api/browse_thread/thread/091522fd001e8f20?hl=en#
Thanks.

nitinkcv

unread,
Jul 14, 2008, 7:52:03 AM7/14/08
to OpenSocial - OpenSocial Application Development
Arne,

Any update on this error?

Thanks,
Nitin

On Jul 12, 1:26 pm, nitinkcv <nitin_1984_2...@yahoo.com> wrote:
> Hi,
>
> Just an update in this error is in this thread alsohttp://groups.google.com/group/opensocial-api/browse_thread/thread/09...
> Thanks.

Arne Roomann-Kurrik (Google)

unread,
Jul 14, 2008, 4:32:25 PM7/14/08
to OpenSocial - OpenSocial Application Development
Hi Nitin,

I'm not really sure why you're getting the Java error - there are
certainly no Java components running client-side on orkut, so I think
that this just has something to do with the Firebug debugger, rather
than being an OpenSocial problem.

Since it looks like you're just appending the name of the city to
the url you're querying for weather data, you should get in the habit
of encoding any parameters you include on the querystring. This will
convert illegal URL characters like space to their urlencoded
equivalents like %20. So instead of doing:

"http://www.google.com/ig/api?weather=" + cityName;

try changing your code to

"http://www.google.com/ig/api?weather=" +
encodeURIComponent(cityName);

to see if that helps at all.

~Arne

nitinkcv

unread,
Jul 15, 2008, 10:15:41 AM7/15/08
to OpenSocial - OpenSocial Application Development
Thanks a lot Arne. the encoding of t eh cityname did the trick.



On Jul 15, 1:32 am, "Arne Roomann-Kurrik (Google)"
Reply all
Reply to author
Forward
0 new messages