3.2.0

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
May 11,
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
May 11,
Thanks but where would the postdata(theXML) itself be put? Is that another property that has to be set?
Karl Thoroddsen
May 11,
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
May 11,
Thanks Tony, I'll give it a try.
Karl Thoroddsen
May 12,
I get a bad request from the web server. Perhaps the http headers are different?
Karl Thoroddsen
May 12,
Looking at the POST request the content-length is 0 and no xml is sent. So the postdata is not sent.

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


Did the trick. :)

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

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

This topic is archived.

See also:


Back to support forum