13
« on: August 06, 2010, 22:03:31 »
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?