[Laszlo-dev] Rest Support

Henry Minsky henry.minsky at gmail.com
Sun Feb 24 09:06:14 PST 2008


Using the .jsp code from Andre to induce a 401 error, I am getting the
onerror event and error string properly


LzLoadQueue.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> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080224/ca966fa8/attachment.html


More information about the Laszlo-dev mailing list