QueueMetrics forum
QueueMetrics => Scripting QueueMetrics => Topic started by: smileyphase on August 05, 2010, 17:58:49
-
I'm running the latest QueueMetrics 1.6.1.1 on a CentOS 5.5 (2.6.18-128.1.6.el5).
I'm running the PHP sample application. I have a queuemetrics robots user created, but seem to be failing out before authentication - it can't find the "xmlrpc.do" file (whether static or dynamically created).
I have a copy of xercesImpl.jar:
/usr/local/queuemetrics/tomcat/common/endorsed/xercesImpl.jar
I tried installing xerces, per ast-recipes (it generated some errors, but was able to mostly compile).
I attempted to move xercesImpl.jar to /usr/local/queuemetrics/webapps/queuemetrics-1.6.1.1/WEB-INF/lib/.
No matter what, I generate the following error (I'm running it from within the queuemetrics directory - php /usr/local/queuemetrics/webapps/queuemetrics-1.6.1.1/test.php):
<h1>A QueueMetrics XML-RPC client in PHP</h1>
HTTP error, got response: HTTP/1.1 404 /queuemetrics-1.6.1.1/xmlrpc.do
Fault Code: 5
Fault Reason: Didn't receive 200 OK from remote server. (HTTP/1.1 404 /queuemetrics-1.6.1.1/xmlrpc.do)
I don't see any catalina.out output.
I'd appreciate any assistance.
-SP
-
The latest versions of QM already have Xerces installed, so this hould not be necessary.
QM itself is working as expected?
-
QM is behaving fine. I'm just not able to connect to XML-RPC using the provided sample code. The user is a ROBOT class user, and I've verified both username/password. There were some funny characters in the sample code on cut-and-paste, which I'd replaced.
Here's the code I'm using:
<h1>A QueueMetrics XML-RPC client in PHP</h1>
<?
require_once 'XML/RPC.php';
$qm_server = "210.120.1.194"; // the QueueMetrics server address
$qm_port = "8099"; // the port QueueMetrics is running on
$qm_webapp = "queuemetrics-1.6.1.1"; // the webapp name for QueueMetrics
// set which response blocks we are looking for
$req_blocks = new XML_RPC_Value(array(
new XML_RPC_Value("DetailsDO.CallsOK"),
new XML_RPC_Value("DetailsDO.CallsKO")
), "array");
// general invocation parameters - see the documentation
$params = array(
new XML_RPC_Value("queue-dps"),
new XML_RPC_Value("robot"),
new XML_RPC_Value("robot"),
new XML_RPC_Value(""),
new XML_RPC_Value(""),
new XML_RPC_Value("2010-08-01.10:23:12"),
new XML_RPC_Value("2011-08-04.10:23:10"),
new XML_RPC_Value(""),
$req_blocks
);
$msg = new XML_RPC_Message('QM.stats', $params);
$cli = new XML_RPC_Client("/$qm_webapp/xmlrpc.do", $qm_server, $qm_port);
//$cli->setDebug(1);
$resp = $cli->send($msg);
if (!$resp) {
echo 'Communication error: ' . $cli->errstr;
exit;
}
if ($resp->faultCode()) {
echo 'Fault Code: ' . $resp->faultCode() . "\n";
echo 'Fault Reason: ' . $resp->faultString() . "\n";
} else {
$val = $resp->value();
$blocks = XML_RPC_decode($val);
// now we print out the details....
printBlock( "result", $blocks );
printBlock( "DetailsDO.CallsOK", $blocks );
printBlock( "DetailsDO.CallsKO", $blocks );
}
// output a response block as HTML
function printBlock( $blockname, $blocks ) {
echo "<h2>Response block: $blockname </h2>";
echo "<table border=1>";
$block = $blocks[$blockname];
for ( $r = 0; $r < sizeof( $block ); $r++ ) {
echo "<tr>";
for ( $c = 0; $c < sizeof( $block[$r] ); $c++ ) {
echo( "<td>" . $block[$r][$c] . "</td>" );
}
echo "</tr>\n";
}
echo "</table>";
}
?>
Where can I find info on queue-dps? Maybe I'm not passing the parameters correctly.
-
An update, I was obviously querying the wrong queue, I added a legit queue. I'm still getting the same error.
The queue is legit, the user's legit.
Here's the updated code snippet:
<html>
<head>
<title>$Id: sample_client.php,v 1.2 2007/05/12 20:45:06 lenz Exp $</title>
</head>
<body>
<h1>A QueueMetrics XML-RPC client written in PHP</h1>
This is a very simple XML-RPC client written in PHP using the standard PEAR library; it is able to query
the QueueMetrics server and obtain a response list to be printed in tabular form. This is provided as a
sample only for your convenience, and you should likely edit the source code parameters to obtain somenthing
meaningful out of it on your own servers.<br>
For more information on the XML-RPC interface of QueueMetrics, see the file "Accessing QueueMetrics through
the XML-RPC interface" available for the <a href="http://queuemetrics.com/download.jsp">downloads</a> page.
See also: <a href="http://pear.php.net/package/XML_RPC">http://pear.php.net/package/XML_RPC</a> for details on
how to write an XML-RPC client or server in PHP.<br>
IMPORTANT:
in order to run this, you must have the XML_RPC module that comes with the PEAR library
correctly installed on your PHP server. See <a href="http://pear.php.net">http://pear.php.net</a>.
<p>
File version: $Id: sample_client.php,v 1.2 2007/05/12 20:45:06 lenz Exp $ <br>
<hr>
<?php
require_once 'XML/RPC.php';
$qm_server = "210.120.1.194"; // the QueueMetrics server address
$qm_port = "8099"; // the port QueueMetrics is running on
$qm_webapp = "queuemetrics-1.6.1.1"; // the webapp name for QueueMetrics
// set which response blocks we are looking for
$req_blocks = new XML_RPC_Value(array(
new XML_RPC_Value("OkDO.RiassAllCalls"),
new XML_RPC_Value("OkDO.AgentsOnQueue")
), "array");
// general invocation parameters - see the documentation
$params = array(
new XML_RPC_Value("CustomerSupportAccountSpecialist"),
new XML_RPC_Value("robot"),
new XML_RPC_Value("robot"),
new XML_RPC_Value(""),
new XML_RPC_Value(""),
new XML_RPC_Value("2010-08-01.10:23:12"),
new XML_RPC_Value("2010-08-04.10:23:10"),
new XML_RPC_Value(""),
$req_blocks
);
$msg = new XML_RPC_Message('QM.stats', $params);
$cli = new XML_RPC_Client("/$qm_webapp/xmlrpc.do", $qm_server, $qm_port);
$cli->setDebug(1);
$resp = $cli->send($msg);
if (!$resp) {
echo 'Communication error: ' . $cli->errstr;
exit;
}
if ($resp->faultCode()) {
echo 'Fault Code: ' . $resp->faultCode() . "\n";
echo 'Fault Reason: ' . $resp->faultString() . "\n";
} else {
$val = $resp->value();
$blocks = XML_RPC_decode($val);
// now we print out the details....
printBlock( "result", $blocks );
printBlock("OkDO.RiassAllCalls", $blocks);
printBlock("OkDO.AgentsOnQueue", $blocks);
}
// output a response block as HTML
function printBlock( $blockname, $blocks ) {
echo "<h2>Response block: $blockname </h2>";
echo "<table border=1>";
$block = $blocks[$blockname];
for ( $r = 0; $r < sizeof( $block ); $r++ ) {
echo "<tr>";
for ( $c = 0; $c < sizeof( $block[$r] ); $c++ ) {
echo( "<td>" . $block[$r][$c] . "</td>" );
}
echo "</tr>\n";
}
echo "</table>";
}
?>
<!--
// $Log: sample_client.php,v $
// Revision 1.2 2007/05/12 20:45:06 lenz
// Merge IMM4
//
// Revision 1.1.2.2 2007/04/03 15:20:05 lenz
// Improved messages.
//
// Revision 1.1.2.1 2007/04/03 13:39:41 lenz
// First version.
//
//
//
-->
</body>
</html>
Here's the output (bolded by me):
<pre>---GOT---
HTTP/1.1 404 /queuemetrics-1.6.1.1/xmlrpc.do
Content-Type: text/html;charset=utf-8
Content-Length: 1045
Date: Fri, 06 Aug 2010 19:56:02 GMT
Server: Apache-Coyote/1.1
Connection: close
<html><head><title>Apache Tomcat/5.0.28 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /queuemetrics-1.6.1.1/xmlrpc.do</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/queuemetrics-1.6.1.1/xmlrpc.do</u></p><p><b>description</b> <u>The requested resource (/queuemetrics-1.6.1.1/xmlrpc.do) is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.0.28</h3></body></html>
---END---</pre>
HTTP error, got response: HTTP/1.1 404 /queuemetrics-1.6.1.1/xmlrpc.do
Fault Code: 5
Fault Reason: Didn't receive 200 OK from remote server. (HTTP/1.1 404 /queuemetrics-1.6.1.1/xmlrpc.do)
I've played with the path -
HTTP error, got response: HTTP/1.1 404 /usr/local/queuemetrics/webapps/queuemetrics-1.6.1.1/xmlrpc.do
Fault Code: 5
Fault Reason: Didn't receive 200 OK from remote server. (HTTP/1.1 404 /usr/local/queuemetrics/webapps/queuemetrics-1.6.1.1/xmlrpc.do)
Same results when it was an absolute path to the queuemetrics directory. It seems that the xmlrpc.do dynamic file is the challenge - or could it be something else?
-
1. make sure QM is working - you can log on etc.
2. keep an eye on the logs/ folder of Tomcat and capture whatever gets written to them.
-
QueueMetrics is working - I can log in, run reports (as the reports user, too), etc...
There's nothing that happens in the catalina.out or localhost_log file.[date] when I run the php app and get a 200 error. I'm running QM on port 8099 (apparently there's a PBX in a Flash conflict with 8080) - the script has this as the port parameter. I've tried it on port 8080 on a system without the conflict.
My report user is running with all user keys (including master key=yes), the account is enabled (I can log in and run reports via the GUI), and is of class ROBOTS.
I've given the ROBOT user class the following keys:
USER USR_MYSQL REALTIME RTLIVE QUEUE_AN AGREP ROBOT CHPASSWD SUPERVISOR QA_REPORT USR_REPORTS
I've tried this with a barebones installation, QM 1.6.1.1 and on a QM 1.6.0.3, and get the same error.
---GOT---
HTTP/1.1 404 /queuemetrics-1.6.1.1/xmlrpc.do
Content-Type: text/html;charset=utf-8
Content-Length: 1045
Date: Tue, 10 Aug 2010 01:17:29 GMT
Server: Apache-Coyote/1.1
Connection: close
<html><head><title>Apache Tomcat/5.0.28 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /queuemetrics-1.6.1.1/xmlrpc.do</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/queuemetrics-1.6.1.1/xmlrpc.do</u></p><p><b>description</b> <u>The requested resource (/queuemetrics-1.6.1.1/xmlrpc.do) is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.0.28</h3></body></html>
---END---
Fault Code: 5 Fault Reason: Didn't receive 200 OK from remote server. (HTTP/1.1 404 /queuemetrics-1.6.1.1/xmlrpc.do)
Any other thoughts?
Thanks,
-SP
-
Yes - are you sure your web.xml file is correct? because that's where the *.do associations are mapped to the servlet. It looks like Tomcat does not know what to do with the .do request....
-
I'm using the default value:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- L O W A Y R E S E A R C H ' s Q U E U E M E T R I C S -->
<servlet>
<servlet-name>
LowayTransactionController
</servlet-name>
<servlet-class>
it.loway.tpf.transaction.servlets.LowayTransactionController
</servlet-class>
<init-param>
<param-name>LICENZA_ARCHITETTURA</param-name>
<param-value>.....</param-value>
</init-param>
<init-param>
<param-name>START_TRANSACTION</param-name>
<param-value>qm_start</param-value>
</init-param>
<init-param>
<param-name>JDBC_DRIVER</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</init-param>
<init-param>
<param-name>JDBC_URL</param-name>
<param-value>jdbc:mysql://localhost/queuemetrics?autoReconnect=true&zeroDateTimeBehavior=convertToNull&jdbcCompliantTruncation=false&user=queuemetrics&password=javadude</param-value>
</init-param>
<init-param>
<param-name>SMTP_HOST</param-name>
<param-value>smtp.myhost</param-value>
</init-param>
<init-param>
<param-name>SMTP_AUTH</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>SMTP_USER</param-name>
<param-value>xxxx</param-value>
</init-param>
<init-param>
<param-name>SMTP_PASSWORD</param-name>
<param-value>xxxxx</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>LowayTransactionController</servlet-name>
<url-pattern>/tpf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>LowayTransactionController</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/sys_errore.jsp</location>
</error-page>
</web-app>
-
Try and run:
wget -O- http://my.qm.server:8080/queuemetrics/xmlrpc.do
and report what you get.
Did you install using yum or manually?
BTW, when I send a request, I get some lines on the /usr/local/queuemetrics/tomcat/logs/catalina.out file like:
[1B28E449CB8A988ABFD8F20828250399] 201008130943 Tempo totale esecuzione verbo 'xmlrpc': 1430 ms
Do you see anything?
I also get:
cat /usr/local/queuemetrics/tomcat/logs/localhost_log.2010-08-13.txt
2010-08-13 09:43:29 StandardContext[/DAILY]LowayTransactionController: [7A555398F6C4BE2D2A0A2637C9559385] 201008130943 Tempo totale esecuzione verbo 'xmlrpc': 72 ms
-
I installed via yum. I get a result, too:
root@pbx:~ $ wget -O- http://210.120.1.194:8099/queuemetrics/xmlrpc.do
--2010-08-13 11:59:36-- http://210.120.1.194:8099/queuemetrics/xmlrpc.do
Connecting to 210.120.1.194:8099... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1 [text/xml]
Saving to: `STDOUT'
0% [ ] 0 --.-K/s
100%[======================================>] 1 --.-K/s in 0s
2010-08-13 11:59:36 (119 KB/s) - `-' saved [1/1]
I also see errors in the logs (which I don't see if I invoke the sample php script)...
2010-08-13 12:01:11 StandardContext[/queuemetrics]LowayTransactionController: [E66DE036DEF916BE371D0740AB2910B2] 201008131201 Tempo totale esecuzione verbo 'xmlrpc': 17 ms
*** DBVER:20
*** Esce 3
REQUEST:
[Fatal Error] :-1:-1: Premature end of file.
redstone.xmlrpc.XmlRpcException: A problem occured during parsing
at redstone.xmlrpc.XmlRpcParser.parse(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:93)
at it.loway.tpf.transaction.servlets.LowayTransactionController.runVerb(LowayTransactionController.java:255)
at it.loway.tpf.transaction.servlets.LowayTransactionController.serveRequest(LowayTransactionController.java:543)
at it.loway.tpf.transaction.servlets.LowayTransactionController.serveRequestWrapper(LowayTransactionController.java:365)
at it.loway.tpf.transaction.servlets.LowayTransactionController.doGet(LowayTransactionController.java:210)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
... 34 more
[E66DE036DEF916BE371D0740AB2910B2] 201008131201 Tempo totale esecuzione verbo 'xmlrpc': 17 ms
-
bumped...
thx!
-
So it's working now?
-
No, I'm still seeing the xerces error mentioned. I was wondering what the cause could be. This is a pretty stock PBX in a Flash, reasonably current release. It's been updated recently.
-
This is correct if you send the calls via wget you get errors, as they are not correct XML-RPC calls. But on the other side, this means that the correct piece of logic is handling them....
-
Well, the customer cancelled the project, but I still want to know how to fix this. I'm using whatever XML-RPC comes with QueueMetrics and related CentOS updates for PBX in a Flash. How would I go about identifying/repairing this?
-
Try reinstalling QM from scratch? what is weird is that we use the very same PRM versions and they seem to work....
-
I did. This is replicated on several VMs, all using PBX in a Flash. I'll try it with another version, maybe a plain vanilla CentOS/Asterisk, or a Debian one and report results.
-
Thanks!