QueueMetrics > Scripting QueueMetrics

Trouble getting Javascript example to work

(1/2) > >>

Scott B:
Hey, I created a test.html with the following code and dropped the rpc.js into the same diretory as frontPage.jsp in my brand-spanking newly updated 1.7.0 Queuemetrics:

<html>
<head>
<title>test.html</title>
<script src="rpc.js"></script>
</head>
<body>
<h1>QueueMetrics JavaScript XML-RPC example </h1>
<script>
var server = "/DAILY/xmlrpc.do";
function run() {
try {
var service = new rpc.ServiceProxy( server, {
asynchronous:false,
protocol: "XML-RPC",
methods: ["QM.stats", "QM.realtime", "QM.auth"]
} );
res = service.QM.stats( "q1", "robot", "robot","", "",
"2005-10-10.10:23:12", "2009-10-10.10:23:10","",
[ "KoDO.DiscCauses", "CallDistrDO.AnsDistrPerDay" ]
);
document.getElementById("RESULT").innerHTML = plotBlocks(res);
} catch(e) {
alert("Error raised: " + e);
}
}
function plotBlocks( hmBlocks ) {
s = "";
for (var i in hmBlocks) {
s += "<h2>Block: " + i + "</h2>";
s += plotBlock( hmBlocks );
}
return s;
}
function plotBlock( arBlock ) {
s = "";
for ( r =0; r < arBlock.length; r++ ) {
s += "<tr>";
for ( c = 0; c < arBlock[r].length; c++ ) {
s += "<td>" + arBlock[r][c] + "</td>";
}
s += "</tr>";
}
return "<table border=1>" + s + "</table>";
}
</script>
<input type="button" value="Click me!" onclick="run();" >
<div id="RESULT"></div>
</body>

</html>



and I get the following error once I click "Click me!"

Block: result

Status   ERR
Description   -- Inner Exception -- Exception: it.loway.tpf.common.exceptions.UserException Stack trace: The user cannot login: 'robot' at it.loway.app.queuemetrics.autenticazione.effettuaLogOn.doRun(effettuaLogOn.java:92) at it.loway.app.queuemetrics.xmlrpc.tpfServer.runClass(tpfServer.java:910) at it.loway.app.queuemetrics.xmlrpc.tpfServer.stats(tpfServer.java:168) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at redstone.xmlrpc.handlers.ReflectiveInvocationHandler.execute(Unknown Source) at redstone.xmlrpc.handlers.ReflectiveInvocationHandler.invoke(Unknown Source) at redstone.xmlrpc.XmlRpcDispatcher.dispatch(Unknown Source) at redstone.xmlrpc.XmlRpcServer.execute(Unknown Source) at it.loway.app.queuemetrics.xmlrpc.tpfServer.doRun(tpfServer.java:91) at it.loway.tpf.transaction.servlets.LowayTransactionController.runVerb(LowayTransactionController.java:262) at it.loway.tpf.transaction.servlets.LowayTransactionController.serveRequest(LowayTransactionController.java:552) at it.loway.tpf.transaction.servlets.LowayTransactionController.serveRequestWrapper(LowayTransactionController.java:373) at it.loway.tpf.transaction.servlets.LowayTransactionController.doPost(LowayTransactionController.java:224) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:619) -- End Inner Exception --
Time elapsed (ms)   19
QM Version   1.7.0.0

Scott B:
Any ideas? The only part of it I really don't understand is the 

var server = "/DAILY/xmlrpc.do"

and searching xmlrpc.do in the pdf manual for the xmlrpc interface is just references to it in other examples in the other languages, with differing syntax. Any ideas?

QueueMetrics:
You need to serve the example from the same container, e.g. Tomcat, that is serving QM.

You could invoke the file as:


--- Code: ---http://myserver:8080/jstest/mypage.html
--- End code ---

and you could have QM available as


--- Code: ---http://myserver:8080/queuemetrics/
--- End code ---

In this case you would set the


--- Code: ---var server = "/queuemetrics/xmlrpc.do";
--- End code ---

Scott B:

--- Quote from: QueueMetrics on March 22, 2011, 14:54:13 ---You need to serve the example from the same container, e.g. Tomcat, that is serving QM.

You could invoke the file as:


--- Code: ---http://myserver:8080/jstest/mypage.html
--- End code ---

and you could have QM available as


--- Code: ---http://myserver:8080/queuemetrics/
--- End code ---

In this case you would set the


--- Code: ---var server = "/queuemetrics/xmlrpc.do";
--- End code ---

--- End quote ---

Great. I made the appropriate changes to my test file and re-uploaded but I still receive the same message.

(edit: genuine use of the word great here. I really appreciate all the help you guys provide on here.)

QueueMetrics:
Question: do you have the RPC library from Google installed?
In such cases, I suggest using TCPDUMP to see what is going on....

Navigation

[0] Message Index

[#] Next page

Go to full version