:: Forum >>

How can I send a POST request instead of a GET through a AT.XML.Table?

var theUpdateTable = new AW.XML.Table;
theDate = new Date();
theUpdateTable.setURL("http://"+location.host+"/test/test.dll/Request?"+theXML+"?"+theDate.getTime());
theUpdateTable.request();


How can I send the 'theXML' data as POSTDATA instead of as part of the URL?
Karl Thoroddsen
Thursday, May 11, 2006
Well This method is part of the inherited class AW.HTTP.request

.defineProperty("requestMethod", "GET");

Try using

theUpdateTable.defineProperty("requestMethod", "POST");

I haven't tested but it might work.
Tony
Thursday, May 11, 2006
Thanks but where would the postdata(theXML) itself be put? Is that another property that has to be set?
Karl Thoroddsen
Thursday, May 11, 2006
From what I can see in the source it could be

theUpdateDate.defineProperty("requestData", "this=that&something=else");

You may want to get Alex to confirm.
Tony
Thursday, May 11, 2006
Thanks Tony, I'll give it a try.
Karl Thoroddsen
Friday, May 12, 2006
I get a bad request from the web server. Perhaps the http headers are different?
Karl Thoroddsen
Friday, May 12, 2006
Looking at the POST request the content-length is 0 and no xml is sent. So the postdata is not sent.

Karl Thoroddsen
Friday, May 12, 2006
theUpdateData.setParameter("command",theXML) instead of theUpdateDate.defineProperty("requestData", theXML);

Did the trick. :)

Thanks Tony.
Karl Thoroddsen
Friday, May 12, 2006
Good deal. I didn't see the "command" param in the source, but glad you got it working.
Tony
Friday, May 12, 2006
Yes, should be something like

theUpdateTable.setRequestMethod("POST");
theUpdateTable.setParameter("command", theXML);
Alex (ActiveWidgets)
Friday, May 12, 2006

This topic is archived.


Back to support forum

Forum search