-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I'm trying to made AU request requests against zkau service. Particularly I need to access some data using direct HTTP requests made by an android app without human interaction by a browser. Every time I send a command I receive this message "Illegal request: cmd required". My request contain all required cookies and post data has the correct dtid.
For example, sending a simple dummy command with http post data run into this issue:
cmd_0=dummy&dtid=z_8490&opt_0=1
Moreover http header contains ZK-SID but I select a random value because I don't understand how and where platform assign it (at least looking at http protocol analyzer results).
What's missing?
Thanks, Pino!
Hi Darksu, unfortunately I can't access web application because it's coded by our IT department and now there's no effort to implement changes to the application. The only way a small developer can do is getting by presentation layer directly.
Hello Virticchio,
Got it, another alternative would be to use unit testing automation with tools like Selenium.
But in this case the components should have a unique id so that you can create the automation scripts.
Best Regards,
Darksu
Hello, I'm continuing to experiment and I can say that I'm on the right track. I downloaded zk framework's source code looking for the method that rise the error Illegal request: cmd required.
This error is thrown in this method
DHtmlUpdateServlet.process
when parsing command
//parse commands
final Configuration config = wapp.getConfiguration();
final List<AuRequest> aureqs;
boolean keepAlive = false;
try {
final boolean timerKeepAlive = config.isTimerKeepAlive();
aureqs = audec.decode(request, desktop);
for (AuRequest aureq: aureqs) {
final String cmdId = aureq.getCommand();
keepAlive = !(!timerKeepAlive && Events.ON_TIMER.equals(cmdId))
&& !"dummy".equals(cmdId);
//dummy is used for PollingServerPush for piggyback
if (keepAlive)
break; //done
}
} catch (Throwable ex) {
log.warn("", ex);
responseError(request, response, Exceptions.getMessage(ex));
return;
}
if (aureqs.isEmpty()) {
final String errmsg = "Illegal request: cmd required";
log.debug(errmsg);
responseError(request, response, errmsg);
return;
}
Shortly, when AUDecoder returns an empty AuRequest list, error is thrown.
List<AuRequest> aureqs = audec.decode(request, desktop);
if (aureqs.isEmpty())
final String errmsg = "Illegal request: cmd required";
What I can't understand is what command is missing. My http request contains all data:
My doubt is about http header ZK-SID but looking source code doesn't seem to be determinant.
Any ideas?
Thanks, Virticchio
Asked: 2016-01-03 17:48:46 +0800
Seen: 18 times
Last updated: Jan 05 '16