Hi Derrell! Thanks for the great, deep answer. It gave me additional info and hints.
I tried to play with the code today (what a program for the weekend ;-) ) and I am almost sure that our web server component makes the mess. About your other suggestions, the second message is a GET, I only made a copy/past error and left the POST message in. Today I re-implemented the call with our library. With this code, the call makes the same (two messages, one POST and one GET, with 303 and 200 result, first containing the result). This is alsó the proof that our module does it wrong. Finally I found the real problem behind. I used closure as event handler, and used the this within, but forget to pass the real this, as target object to the addListener call. :-) This was one of the mistakes I did. Now it works, even with the seemingly double message. (In reality they seems to be one, but something is messy about them, so I passed the question to its developer ;-)) Thanks for your help! Balage PS: One interesting side-experience: The result is created in server side as a 2 dimensional array. From this an XML is created, then posted to the client, where a DOM is built from it, iterated to create the array for a TableModel. I thought to reduce this procedure by creating JavaScrpt array definition on server side and calling eval on it, then passing the array to the Table. What make me suprise is the slowliness of the eval() function. I tried with different size of data and while with small result set the speed was equal and ignorable, the eval became quite slow quickly even against the more intermediate datastructure creation overhead. (By numbers: with a dataset of the (XML) size of 750K is 4-times faster, and with a huge dataset of 10K rows with 20 columns (5MB as XML) the difference is 7-times! So I returned the XML format. ;-) BTW, The Table widget of qooxdoo is incredible fast. ;-) ________________________________ From: Derrell Lipman <[email protected]> To: qooxdoo Development <[email protected]> Sent: Sat, December 12, 2009 8:04:50 PM Subject: Re: [qooxdoo-devel] XMLHttpRequest and POST messages and notification On Sat, Dec 12, 2009 at 02:56, <[email protected]> wrote: > > >Thank you for your answer. I try to collect all information. > Thanks. With this I should be able to at least point you somewhat towards finding a solution. - The first thing that immediately jumps out at me is that the server is sending back what could be a valid response (it's a bunch of JavaScript) and yet the response it's sending should therefore have been 200, not 303. It looks to me like the server is intending to send back a 200 and its response but for some reason is setting the result code to 303. A result code of 303 is a "failure" indication as far as qooxdoo is concerned. The "failed" handler should be called. - The second request you state is a GET, and yet it has POST data. Why do you believe it's a GET? That second request succeeds (status 200) and returns data, again, that looks like JavaScript. - There is no code in qx.io.remote.*, AFAIR, to do any retransmissions, so that second request is almost certainly being made by your code, not by some automatic action within qooxdoo. - The value you pass as the third parameter to the Request constructor is the expected response type, and determines what qooxdoo does with the response before handing the response to the user. If you expect JavaScript to be returned, presumably you want that code to be eval()'ed. You should then pass "text/javascript" as the expected response type. What you get back, then, from response.getContent() would be the result of eval()'ing that JavaScript code... i.e. typically the value of the last expression in the code. Alternatively, if you just want to retrieve the text of the JavaScript that was returned in the result, you could use "text/plain" as the third parameter to the constructor, in which case no processing will be done on the result. Hopefully that gives you some pointers on where to look. The first thing I'd look into is why the server is returning a 303 seemingly improperly. Cheers, Derrell > > >The code I use: > > > >----------------------------------------------------------------------------------- > >sendXMLHTTPRequest : function( pRequestData, pContext ) >> >{ >// Storing context map >this.__context = pContext; > >var isAsynchron = pContext['asynchron'] != 'false'; > > >// Callback function specification >if (pContext['callback'] == 'undefined') >> >this.__xhReqCallbackFunctionHolder = this.__xhReqEmptyCallbackFunction; >else >this.__xhReqCallbackFunctionHolder = pContext['callback']; > >if (pContext['callbackError'] == 'undefined') >> >this.__xhReqCallBackFunctionErrorHandlerFunctionHolder = > this.__xhReqDefaultErrorHandlerFunction; >else >this.__xhReqCallbackFunctionHolder = pContext['callbackError']; > >// Building message body >var parameters="--BOUNDARY-12345\n"; >parameters += "Content-Disposition: form-data; name=\"FORM_ID\"\n\n"; >> >parameters += edemo.EventusUtils.getInstance().getFormId() +"\n\n"; >parameters += "--BOUNDARY-12345\n"; >parameters += "Content-Disposition: form-data; name=\"xml_data\"\n\n"; >> >parameters += pRequestData+"\n\n"; >parameters += "--BOUNDARY-12345--\n"; > > >var resultMIME = edemo.AjaxTools.DEFAULT_MIME; >if ( pContext['resultMIME'] != 'undefined' ) resultMIME = >pContext['resultMIME']; > >// Creating HTTPRequest (for testing I use wired-in address) >this.__xhReq = new qx.io.remote.Request( >'https://195.228.146.232/cgi-bin/evisapi.dll?XMLHTTPREQUEST', 'POST', >resultMIME > ); >this.__xhReq.setAsynchronous(isAsynchron); >this.__xhReq.setProhibitCaching(false); >this.__xhReq.setRequestHeader("Content-Type", "multipart/form-data; >boundary=BOUNDARY-12345; charset=UTF-8"); >> >this.__xhReq.setData( parameters ); >this.__xhReq.addListener("failed", this.test ); >this.__xhReq.addListener("completed", function(e) { >this.test(e); >if (this.__xhReqInternalCallbackFunction != null) >> >this.__xhReqInternalCallbackFunction(); >} ); >this.__xhReq.send(); > >if ( !isAsynchron ) >{ >if (this.__xhReqInternalCallbackFunction != null) >this.__xhReqInternalCallbackFunction(); > >return (this.__xhReq.status == 200); >> >} > >return true; > >}, > >----------------------------------------------------------------------------------- > >The evisapi.dll is our web server module (called dll only for convenience, >because it is available both to IIS on Windows and apache on Unix-like > OS), > >now we use Apache). It keeps the connection between the client and the AS. > > >Additionally, DEFAULT_MIME is 'text/plain', but I also tried application/xml >for other message, and I ran into an error (see my other post about it). > >I call this function by the following statement: > >----------------------------------------------------------------------------------- > >hrq.sendXMLHTTPRequest( '<QD_FETCH_TEST_TEXT table="'+ tableCode +'"/>', { >> >asynchron : false >} ); > > > >----------------------------------------------------------------------------------- > > >Here is the Firebug info for the POST request: > > >Status: >303 See Other 45ms > >Response headers: > > >Date Sat, 12 Dec 2009 > 08:49:23 GMT >Server Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny3 with Suhosin-Patch >mod_ssl/2.2.9 OpenSSL/0.9.8g >Pragma no-cache >>Set-Cookie EVISAPI_DLL=49B7.BFDCD858.4B235913;path=/cgi-bin/evisapi.dll >Location /cgi-bin/evisapi.dll/?REAL_RESP=1 >Content-Length 87 >Keep-Alive timeout=15, > max=100 >Connection Keep-Alive >Content-Type text/html > > > >Request headers: > >Host 195.228.146.232 >User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; hu; rv:1.9.1.5) >Gecko/20091102 Firefox/3.5.5 >Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 >Accept-Language hu-hu,hu;q=0.8,en-us;q=0.5,en;q=0.3 >Accept-Encoding gzip,deflate >Accept-Charset ISO-8859-2,utf-8;q=0.7,*;q=0.7 >Keep-Alive 300 >Connection keep-alive >Content-Type multipart/form-data; boundary=BOUNDARY-12345; charset=UTF-8 >Referer https://195.228.146.232/files/app/fullframe/index.html >Content-Length 219 >Cookie *** >Authorization Basic aWZsb3c6dC5yYWIsYW4tdF82MCE= >Pragma no-cache >Cache-Control no-cache > > >Post: >--BOUNDARY-12345 > >Content-Disposition: form-data; name="FORM_ID" > > >tmpform_7682.2:1 > > >> --BOUNDARY-12345 > >Content-Disposition: form-data; name="xml_data" > > ><QD_FETCH_TEST_TEXT table="AD_SYSTEM_PARAMETER"/> > > >--BOUNDARY-12345-- > > >Response: >> >var eqColumnCount = 4; > >var eqColumnNameList = [ 'SYSTEM_PARAMETER_CODE', 'PARAMETER_VALUE', 'EID', >'ETS' ]; > >var eqColumnTypeList = [ 'string', 'string', 'string', 'string' ]; > >var eqData = [ > > ['LNPS_CARRY_SURE', '1', '710000.563', '710000.563'], > > ['LNPS_PATIENT_TIME', '1', '710000.564', '710000.564'], > >> > ['LNPS_AGAIN_PSM', '2', '710000.565', '710000.565'], > > ['LNPS_ONDEMAND', 'FALSE', '710000.566', '710000.16532957'], > > ['FILEIO_PATH', 'FILEIO_PATH', '710000.567', '710000.6631320'], > > ['FLOW_RELEASE_CODE', 'EVENTUS_R3', '710000.568', '710000.568'], > > ['LICENCE_FIXED', '3000', '710000.569', '710000.11155099'], > > ['LICENCE_FLOATING', '20', > '710000.570', '710000.570'], > > ['RT_TASK_ROLE_CACHE_UPDATE_TICKET_ID', '0', '710000.571', > '110070.35482846'], > > ['DEFAULT_LANGUAGE', 'Hungarian', '710000.572', '710000.32615107'] > >]; > > > >Here is the Firebug info for the GET request: > > >Status: >200 OK 51ms > >Response headers: > >Date Sat, 12 Dec 2009 08:49:23 GMT >Server Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny3 with Suhosin-Patch >mod_ssl/2.2.9 OpenSSL/0.9.8g >Accept-Ranges none >Content-Length 838 >Keep-Alive timeout=15, max=99 >Connection Keep-Alive >Content-Type text/html >> > >Request headers: > >Host 195.228.146.232 >User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; hu; rv:1.9.1.5) >Gecko/20091102 Firefox/3.5.5 >Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 >Accept-Language hu-hu,hu;q=0.8,en-us;q=0.5,en;q=0.3 >Accept-Encoding gzip,deflate >Accept-Charset ISO-8859-2,utf-8;q=0.7,*;q=0.7 >Keep-Alive 300 >Connection keep-alive >Referer https://195.228.146.232/files/app/fullframe/index.html >Cookie **** >Authorization Basic aWZsb3c6dC5yYWIsYW4tdF82MCE= >Pragma no-cache >Cache-Control no-cache > > >Post: >--BOUNDARY-12345 > >Content-Disposition: form-data; name="FORM_ID" > > >tmpform_7682.2:1 > > >--BOUNDARY-12345 > >Content-Disposition: form-data; > name="xml_data" > > ><QD_FETCH_TEST_TEXT table="AD_SYSTEM_PARAMETER"/> > > >--BOUNDARY-12345-- > > >Response: >var eqColumnCount = 4; > >var eqColumnNameList = [ 'SYSTEM_PARAMETER_CODE', 'PARAMETER_VALUE', 'EID', >'ETS' ]; > >var eqColumnTypeList = [ 'string', 'string', 'string', 'string' ]; > >var eqData = [ > > ['LNPS_CARRY_SURE', '1', '710000.563', '710000.563'], > > ['LNPS_PATIENT_TIME', '1', '710000.564', '710000.564'], > > ['LNPS_AGAIN_PSM', '2', '710000.565', '710000.565'], > > ['LNPS_ONDEMAND', 'FALSE', '710000.566', '710000.16532957'], > > ['FILEIO_PATH', 'FILEIO_PATH', '710000.567', '710000.6631320'], > > ['FLOW_RELEASE_CODE', 'EVENTUS_R3', '710000.568', '710000.568'], > > ['LICENCE_FIXED', '3000', '710000.569', '710000.11155099'], > > ['LICENCE_FLOATING', '20', '710000.570', '710000.570'], > > > ['RT_TASK_ROLE_CACHE_UPDATE_TICKET_ID', '0', '710000.571', > '110070.35482846'], > > ['DEFAULT_LANGUAGE', 'Hungarian', '710000.572', '710000.32615107'] > >]; > >----------------------------------------------------------------------------------- > > > >If you would like, I could present our low-level solution which works. > > >Thank you for your help! > > >Balage > > > >________________________________ >From: Derrell Lipman <[email protected]> >> >To: qooxdoo Development <[email protected]> >Sent: Fri, December 11, 2009 5:54:06 PM >Subject: Re: [qooxdoo-devel] XMLHttpRequest and POST messages and notification >> > > >On Fri, Dec 11, 2009 at 11:31, <[email protected]> wrote: > >> >>Hi! >> >>>I've got ahead with the qx.io.remote.Request problem. In the archives > I >>>find information that even when I send my request as POST, >>>the result comes as GET. I found that for each of my request, there is >>>two message entry appears in the firebug log: >> >> >>>- the original POST message, which seemingly contains the correct answer, >>>but has a status code of 303 (See Other) >>>- an interesting GET message, which has an OK (200) result code. >> >>>However, the event handler assigned to the Request object isn't called. >>>(Neither the "completed", nor the "failed".) >> >> >>>To the whole picture, we use a propriety web-server component (which keeps >>>the connection with our AS), so >>>I am not entirely free to juggle with GET/POST messages. :-( >> >>>Is there a way to use the POST message and hook on the completement trigger? >> >> > >POST requests work fine. Why don't you post a code snippet and maybe we can >tell you what you're > doing wrong. Also, if you could post the details of the initial POST, its > reply with 303, the subsequent GET, and it's 200 reply as seen in FireBug's > "Net" tab, that would probably be useful. > >Derrell >------------------------------------------------------------------------------ >>Return on Information: >>Google Enterprise Search pays you back >>Get the facts. >>http://p.sf.net/sfu/google-dev2dev > >_______________________________________________ >>qooxdoo-devel mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
