3.0.5

Please help with AW HTTP Request -Company is eval AW2.0


My company is in the process of evaluating the AW library … I’m trying to put a simple HTTP pages using gSoap as my backend HTTP server… so far is very good; except for the AW documentation; however, I ran into this problem that I can’t solved. Please keep in mind that I’m relative new to WEB technology.

This is the problem:

I send a HTTP Post request to my gSoap server…(i.e. HTTP server)… by using the AW HTTP Request object. The request arrives to my HTTP server and it replies with the proper html file which is received by the AW HTTP Request callback. The returned page contains references to the AW.UI.input etc…

In short, the browser displays the HTML page; but it gives a java script error that it can’t find AW references… (I placed the gsoap in debug mode and the browser does not request for the aw.js scripts… This work if I create regular hyperlinks…I can create links and point to other server supplied html files and the html file and the aw.js are retrieved by the browser correctly…) It does not work if I used the HTTP Request.

Can anyone help me? Please find attached some of the html code…I wonder if this is the proper way to render the page in the AW HTTP Request callback…
document.open();
document.write(req.getResponseText());
document.close();

Here is some html code
Note: The submitPage gets the generror.html via a post…the generror.html has link references to the AW.UI.input..

<html>
<head>
<title>System License Attributes Sends Post Request for Error page just to demo...</title>
<script src="../../ActiveWidgets/runtime/lib/aw.js"></script>
<link href="../../ActiveWidgets/runtime/styles/xp/aw.css" rel="stylesheet"></link>

<link href="../../ActiveWidgets/runtime/styles/xp/mini.css" rel="stylesheet"></link>
<style>
……..
</style>

<script>
var iDir ;
//post request
function submitPage()
{
var req = new AW.HTTP.Request;
req.setURL("http://w.x.y.z:8080/generror.html");
req.setRequestMethod("POST");
req.setAsync(false);
req.setUsername("admin");
req.setPassword("guest");

var dirval = iDir.getContent('box/text').element().getAttribute("value");
req.setParameter("dirInput",dirval);
req.response = function(text) {
alert(this.getResponseText());
[b]document.open();
document.write(this.getResponseText());
document.close();
};
req.request();

}
</script>[/b]...........
</html>

//the above html file works correctly.. but when a post request for this html file is requested…
//it fails to find ActiveWidget aw.js…
<head>
<title>Error Display Demo</title>
<script src="../../ActiveWidgets/runtime/lib/aw.js"></script>
<link href="../../ActiveWidgets/runtime/styles/xp/aw.css" rel="stylesheet"></link>
<link href="../../ActiveWidgets/runtime/styles/xp/mini.css" rel="stylesheet"></link>
<style>

#.....

</style>
</head>
<body BACKGROUND="../images/bodybackground-paper.jpg" >
<script>

var iError = new AW.UI.Input;
iError.setId("errorInput");
iError.setControlText("Generic Error found ...\n");
document.write(iError);

var okBut= new AW.UI.Button;
okBut.setId("okBut");
okBut.setControlText("OK");
okBut.setControlImage("accept");
document.write(okBut);

</script>

<div id="userPicture">
<img src="../images/working-in-computer12.gif"></img>
</div>


</body>
</html>
JohnC
June 4,
When you use

document.open();
document.write(pageHTML);
document.close();

the url of the page does not change, i.e. it stays the same as the previous one. Try using absolute references for the aw.js and aw.css files (including server name) and see if it fixes the problem.
Alex (ActiveWidgets)
June 6,

This topic is archived.

See also:


Back to support forum