JSONP , callback never called, qooxdoo 1.6

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

JSONP , callback never called, qooxdoo 1.6

Vassili Gontcharov
Hi,
I use playframework(Java)  as backend and qooxdoo as frond-end.
qx.io.request.Jsonp is used for fetching data from my server.
This is one part of my code:

var req = new qx.io.request.Jsonp();
req.setUrl(url);
req.addListener("success", function(e) {
this.debug("I'm getting data ");
}

Success callback is never called but I can see in firebug window server's json data. 

I tried qx.io.remote.Request with same result.

I made some tests 2-3 weeks ago  with Django, server json response is same, it worked well.

This response header 
Server Play! Framework;1.2.4;dev
Access-Control-Allow-Orig...*
Content-Type text/javascript;charset=utf-8
Set-CookiePLAY_FLASH=;Expires=Mon, 23-Jan-12 12:53:12 GMT;Path=/ PLAY_ERRORS=;Expires=Mon, 23-Jan-12 12:53:12 GMT;Path=/ PLAY_SESSION=;Expires=Mon, 23-Jan-12 12:53:12 GMT;Path=/
Cache-Controlno-cache
Content-Length3628

And my test data
aststats.page.dashboard.Content.saveResult({"Calls": [{"accountcode":"","amaflags":3,"billsec":0,"calldate":"20-01-2012 16:09:52","channel":"SIP/6001-00000006","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"0614000000","dstchannel":"DAHDI/i1/614000000-1","duration":17,"lastapp":"Dial","lastdata":"DAHDI/g6/614000000","src":"6001","uniqueid":"1327072192.62","userfield":"","id":171},{"accountcode":"","amaflags":3,"billsec":1,"calldate":"19-01-2012 08:15:22","channel":"IAX2/6003-4833","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"SIP/6001-00000005","duration":3,"lastapp":"Dial","lastdata":"SIP/6001\u0026IAX2/6001,20,","src":"6003","uniqueid":"1326957322.60","userfield":"","id":170},{"accountcode":"","amaflags":3,"billsec":2,"calldate":"19-01-2012 08:14:55","channel":"IAX2/6003-5459","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"","duration":2,"lastapp":"VoiceMail","lastdata":"6001,u","src":"6003","uniqueid":"1326957295.59","userfield":"","id":169},{"accountcode":"","amaflags":3,"billsec":2,"calldate":"19-01-2012 08:14:49","channel":"IAX2/6003-1307","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"","duration":2,"lastapp":"VoiceMail","lastdata":"6001,u","src":"6003","uniqueid":"1326957289.58","userfield":"","id":168},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"19-01-2012 08:14:39","channel":"SIP/6001-00000003","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000004","duration":4,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326957279.56","userfield":"","id":167},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:35:35","channel":"SIP/6001-00000001","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000002","duration":4,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326875735.2","userfield":"","id":166},{"accountcode":"","amaflags":3,"billsec":1,"calldate":"18-01-2012 09:35:27","channel":"IAX2/6003-4890","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"SIP/6001-00000000","duration":3,"lastapp":"Dial","lastdata":"SIP/6001\u0026IAX2/6001,20,","src":"6003","uniqueid":"1326875727.0","userfield":"","id":165},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:33:50","channel":"IAX2/6003-3235","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"6001","dstchannel":"SIP/6001-00000016","duration":4,"lastapp":"Dial","lastdata":"SIP/6001\u0026IAX2/6001,20,","src":"6003","uniqueid":"1326875630.64","userfield":"","id":164},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:33:35","channel":"SIP/6001-00000014","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000015","duration":4,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326875615.62","userfield":"","id":163},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:32:51","channel":"SIP/6001-00000012","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000013","duration":6,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326875571.60","userfield":"","id":162}]})

Any idea ?
Thank



--
Vassili Gontcharov

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: JSONP , callback never called, qooxdoo 1.6

Tristan Koch
Hi Vassili,

you need to tell qooxdoo which callback to expect:

req.setCallbackName("aststats.page.dashboard.Content.saveResult")

But actually, it is easier and more flexible [1] if you remove the callback parameter from the URL and let qooxdoo insert it. By default, it is callback=<some-generated-name>.

>From your example I conclude that your service seems to expect the callback name in "callback" parameter, which coincides with the default of qooxdoo. But just in case your service expects another callback parameter (another popular example is "json"), you can override it with:

req.setCallbackParam("json")

If you encounter any further problems, please enable IO debugging [2]. From the log you should be able to see what callback qooxdoo expects to be called by the script (JSONP) loaded from the server.

Hope this helps!

Regards
Tristan

[1] Allows to connect multiple JSONP responses to different requests
[2] http://manual.qooxdoo.org/1.6.x/pages/communication/request_io.html#debugging

Am 23.01.2012 um 14:11 schrieb Vassili Gontcharov:

> Hi,
> I use playframework(Java)  as backend and qooxdoo as frond-end.
> qx.io.request.Jsonp is used for fetching data from my server.
> This is one part of my code:
>
> url = "http://localhost:9000/cdr/dashboards/mostRecentsCalls/?format=json&callback=aststats.page.dashboard.Content.saveResult";
> var req = new qx.io.request.Jsonp();
> req.setUrl(url);
> req.addListener("success", function(e) {
> this.debug("I'm getting data ");
> }
>
> Success callback is never called but I can see in firebug window server's json data.
>
> I tried qx.io.remote.Request with same result.
>
> I made some tests 2-3 weeks ago  with Django, server json response is same, it worked well.
>
> This response header
> Server Play! Framework;1.2.4;dev
> Access-Control-Allow-Orig...*
> Content-Type text/javascript;charset=utf-8
> Set-CookiePLAY_FLASH=;Expires=Mon, 23-Jan-12 12:53:12 GMT;Path=/ PLAY_ERRORS=;Expires=Mon, 23-Jan-12 12:53:12 GMT;Path=/ PLAY_SESSION=;Expires=Mon, 23-Jan-12 12:53:12 GMT;Path=/
> Cache-Controlno-cache
> Content-Length3628
>
> And my test data
> aststats.page.dashboard.Content.saveResult({"Calls": [{"accountcode":"","amaflags":3,"billsec":0,"calldate":"20-01-2012 16:09:52","channel":"SIP/6001-00000006","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"0614000000","dstchannel":"DAHDI/i1/614000000-1","duration":17,"lastapp":"Dial","lastdata":"DAHDI/g6/614000000","src":"6001","uniqueid":"1327072192.62","userfield":"","id":171},{"accountcode":"","amaflags":3,"billsec":1,"calldate":"19-01-2012 08:15:22","channel":"IAX2/6003-4833","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"SIP/6001-00000005","duration":3,"lastapp":"Dial","lastdata":"SIP/6001\u0026IAX2/6001,20,","src":"6003","uniqueid":"1326957322.60","userfield":"","id":170},{"accountcode":"","amaflags":3,"billsec":2,"calldate":"19-01-2012 08:14:55","channel":"IAX2/6003-5459","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"","duration":2,"lastapp":"VoiceMail","lastdata":"6001,u","src":"6003","uniqueid":"1326957295.59","userfield":"","id":169},{"accountcode":"","amaflags":3,"billsec":2,"calldate":"19-01-2012 08:14:49","channel":"IAX2/6003-1307","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"","duration":2,"lastapp":"VoiceMail","lastdata":"6001,u","src":"6003","uniqueid":"1326957289.58","userfield":"","id":168},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"19-01-2012 08:14:39","channel":"SIP/6001-00000003","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000004","duration":4,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326957279.56","userfield":"","id":167},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:35:35","channel":"SIP/6001-00000001","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000002","duration":4,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326875735.2","userfield":"","id":166},{"accountcode":"","amaflags":3,"billsec":1,"calldate":"18-01-2012 09:35:27","channel":"IAX2/6003-4890","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"SIP/6001-00000000","duration":3,"lastapp":"Dial","lastdata":"SIP/6001\u0026IAX2/6001,20,","src":"6003","uniqueid":"1326875727.0","userfield":"","id":165},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:33:50","channel":"IAX2/6003-3235","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"6001","dstchannel":"SIP/6001-00000016","duration":4,"lastapp":"Dial","lastdata":"SIP/6001\u0026IAX2/6001,20,","src":"6003","uniqueid":"1326875630.64","userfield":"","id":164},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:33:35","channel":"SIP/6001-00000014","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000015","duration":4,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326875615.62","userfield":"","id":163},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:32:51","channel":"SIP/6001-00000012","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000013","duration":6,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326875571.60","userfield":"","id":162}]})
>
> Any idea ?
> Thank
>
>
>
> --
> Vassili Gontcharov
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2_______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: JSONP , callback never called, qooxdoo 1.6

Vassili Gontcharov
Hi Tristan,
It works now, thank :-)
My fault was I used callback parameter in my url, I deleted callback from url and let qooxdoo manage it.
But I can't understand what it worked with my django server ...

Is there a possibility to use a "request queue" for JSONP requests ?

Vassili



2012/1/23 Tristan Koch <[hidden email]>
Hi Vassili,

you need to tell qooxdoo which callback to expect:

req.setCallbackName("aststats.page.dashboard.Content.saveResult")

But actually, it is easier and more flexible [1] if you remove the callback parameter from the URL and let qooxdoo insert it. By default, it is callback=<some-generated-name>.

>From your example I conclude that your service seems to expect the callback name in "callback" parameter, which coincides with the default of qooxdoo. But just in case your service expects another callback parameter (another popular example is "json"), you can override it with:

req.setCallbackParam("json")

If you encounter any further problems, please enable IO debugging [2]. From the log you should be able to see what callback qooxdoo expects to be called by the script (JSONP) loaded from the server.

Hope this helps!

Regards
Tristan

[1] Allows to connect multiple JSONP responses to different requests
[2] http://manual.qooxdoo.org/1.6.x/pages/communication/request_io.html#debugging

Am 23.01.2012 um 14:11 schrieb Vassili Gontcharov:

> Hi,
> I use playframework(Java)  as backend and qooxdoo as frond-end.
> qx.io.request.Jsonp is used for fetching data from my server.
> This is one part of my code:
>
> url = "http://localhost:9000/cdr/dashboards/mostRecentsCalls/?format=json&callback=aststats.page.dashboard.Content.saveResult";
> var req = new qx.io.request.Jsonp();
> req.setUrl(url);
> req.addListener("success", function(e) {
>       this.debug("I'm getting data ");
> }
>
> Success callback is never called but I can see in firebug window server's json data.
>
> I tried qx.io.remote.Request with same result.
>
> I made some tests 2-3 weeks ago  with Django, server json response is same, it worked well.
>
> This response header
> Server Play! Framework;1.2.4;dev
> Access-Control-Allow-Orig...*
> Content-Type text/javascript;charset=utf-8
> Set-CookiePLAY_FLASH=;Expires=Mon, 23-Jan-12 12:53:12 GMT;Path=/ PLAY_ERRORS=;Expires=Mon, 23-Jan-12 12:53:12 GMT;Path=/ PLAY_SESSION=;Expires=Mon, 23-Jan-12 12:53:12 GMT;Path=/
> Cache-Controlno-cache
> Content-Length3628
>
> And my test data
> aststats.page.dashboard.Content.saveResult({"Calls": [{"accountcode":"","amaflags":3,"billsec":0,"calldate":"20-01-2012 16:09:52","channel":"SIP/6001-00000006","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"0614000000","dstchannel":"DAHDI/i1/614000000-1","duration":17,"lastapp":"Dial","lastdata":"DAHDI/g6/614000000","src":"6001","uniqueid":"1327072192.62","userfield":"","id":171},{"accountcode":"","amaflags":3,"billsec":1,"calldate":"19-01-2012 08:15:22","channel":"IAX2/6003-4833","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"SIP/6001-00000005","duration":3,"lastapp":"Dial","lastdata":"SIP/6001\u0026IAX2/6001,20,","src":"6003","uniqueid":"1326957322.60","userfield":"","id":170},{"accountcode":"","amaflags":3,"billsec":2,"calldate":"19-01-2012 08:14:55","channel":"IAX2/6003-5459","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"","duration":2,"lastapp":"VoiceMail","lastdata":"6001,u","src":"6003","uniqueid":"1326957295.59","userfield":"","id":169},{"accountcode":"","amaflags":3,"billsec":2,"calldate":"19-01-2012 08:14:49","channel":"IAX2/6003-1307","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"","duration":2,"lastapp":"VoiceMail","lastdata":"6001,u","src":"6003","uniqueid":"1326957289.58","userfield":"","id":168},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"19-01-2012 08:14:39","channel":"SIP/6001-00000003","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000004","duration":4,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326957279.56","userfield":"","id":167},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:35:35","channel":"SIP/6001-00000001","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000002","duration":4,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326875735.2","userfield":"","id":166},{"accountcode":"","amaflags":3,"billsec":1,"calldate":"18-01-2012 09:35:27","channel":"IAX2/6003-4890","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"ANSWERED","dst":"6001","dstchannel":"SIP/6001-00000000","duration":3,"lastapp":"Dial","lastdata":"SIP/6001\u0026IAX2/6001,20,","src":"6003","uniqueid":"1326875727.0","userfield":"","id":165},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:33:50","channel":"IAX2/6003-3235","clid":"\"User 6003\" \u003c6003\u003e","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"6001","dstchannel":"SIP/6001-00000016","duration":4,"lastapp":"Dial","lastdata":"SIP/6001\u0026IAX2/6001,20,","src":"6003","uniqueid":"1326875630.64","userfield":"","id":164},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:33:35","channel":"SIP/6001-00000014","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000015","duration":4,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326875615.62","userfield":"","id":163},{"accountcode":"","amaflags":3,"billsec":0,"calldate":"18-01-2012 09:32:51","channel":"SIP/6001-00000012","clid":"6001","dcontext":"DLPN_DialPlan1","disposition":"NO ANSWER","dst":"9001","dstchannel":"SIP/trunk_2-00000013","duration":6,"lastapp":"Dial","lastdata":"SIP/trunk_2/9001","src":"6001","uniqueid":"1326875571.60","userfield":"","id":162}]})
>
> Any idea ?
> Thank
>
>
>
> --
> Vassili Gontcharov
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2_______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



--
Vassili Gontcharov

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: JSONP , callback never called, qooxdoo 1.6

Tristan Koch
Hi Vassili,

> Is there a possibility to use a "request queue" for JSONP requests ?

JSONP requests basically work by adding a script element to the DOM. If you make a lot of concurrent requests, the browser may process them in batches but no request should get lost.

Not sure what you mean by request queue. What is your use case? Do you need data to load in a specific order?

Regards
Tristan
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel