[Laszlo-dev] Rest Support
Elias Khalil
elias.khalil at g.ho.st
Mon Feb 25 13:09:49 PST 2008
On swf version 4.0.10 we get the following:
Using proxied mode: we can get the error string as in you example, but we need to get a user defined message with the error string
e.g using the jsp file sent by Andre we can define a customized error message
<% response.sendError(401, " My message "); %>
How can we read the " My message " in the onerror handler?
Using the non proxied mode calling dataset.getErrorString() still result in error “client could not parse XML from server”
Any Ideas how to handle it?
For our application we are still using version 4.0.8 and we are not able to upgrade to 4.0.10 since we are having XmlRpc calls and it seems that XmlRpc is not working well in version 4.0.10
----- Original Message -----
From: "Henry Minsky" <henry.minsky at gmail.com>
To: "Elias Khalil" <elias.khalil at g.ho.st>
Cc: laszlo-dev at openlaszlo.org
Sent: Sunday, February 24, 2008 7:06:14 PM (GMT+0200) Auto-Detected
Subject: Re: [Laszlo-dev] Rest Support
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/20080225/f28880ea/attachment.html
More information about the Laszlo-dev
mailing list