QueueMetrics > Scripting QueueMetrics

XML-RPC- Can't Find xmlrpc.do

(1/4) > >>

smileyphase:
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

QueueMetrics:
The latest versions of QM already have Xerces installed, so this hould not be necessary.
QM itself is working as expected?

smileyphase:
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:


--- Code: ---<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>";
}
?>

--- End code ---

Where can I find info on queue-dps? Maybe I'm not passing the parameters correctly.

smileyphase:
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:


--- Code: ---<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>

--- End code ---

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?

QueueMetrics:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version