Using the .jsp code from Andre to induce a 401 error, I am getting the onerror event and error string properlyLzLoadQueue.XMLOnDataHandler success <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE laszlo-data><resultset><error status="2" msg="data source error for http://127.0.0.1:8080/trunk/test/post2/foo.jsp: HTTP Status code: 401:Unauthorized"/></resultset> «LoadObj#0| err.lzx (loading)» «LzLoader#1| err.lzx (loading)» ERROR: data source error for http://127.0.0.1:8080/trunk/test/post2/foo.jsp: HTTP Status code: 401:Unauthorized onerror data source error for http://127.0.0.1:8080/trunk/test/post2/foo.jsp: HTTP Status code: 401:Unauthorized lzx> mydata.getErrorString() 'data source error for http://127.0.0.1:8080/trunk/test/post2/foo.jsp: HTTP Status code: 401:Unauthorized' lzx> Are you sure you are actually being sent a 401 error from your back-end server? On Sun, Feb 24, 2008 at 8:07 AM, Elias Khalil <elias.khalil at g.ho.st <http://www.openlaszlo.org/mailman/listinfo/laszlo-dev>> wrote: >/ I am trying to call REST APIs from openlaszlo. I tried to make a dataset />/ http request and it worked fine on success. But in case where the REST />/ returns an error like HTTP Error 401 – Unauthorized I can't read the error />/ string or code. It behaves as the following: />/ On proxied mode: dataset.getErrorString()always return null while in />/ debugger there is a message showing the error type but we can't access it />/ On non proxied mode: calling dataset.getErrorString() result in error />/ "client could not parse XML from server" />/ Using Xmlhttprequest is also not helpful where it always cast errors types />/ to http error 500 />/ />/ In order to support calling basic REST APIs, I need to get a clear HTTP />/ Error code and also be able to read the http content in case of error. />/ / -- Henry Minsky Software Architect hminsky at laszlosystems.com <http://www.openlaszlo.org/mailman/listinfo/laszlo-dev>
Which version of OpenLaszlo do you use, because there was a bug
("http://www.openlaszlo.org/jira/browse/LPP-4946"), but it is fixed in
4.0.10.
