Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - avishnev

Pages: [1]
1
I am using QM 1.7.0.2 and was trying to test XML-RPC interface by getting the Realtime stats. Starting with a sample php script in the manual for Stats, I modified it to look for Realtime blocks and inbound parameters. When I ran my script (see attached), I get Invalid method name response. the script is using robot user that is enabled in the system.
Code: [Select]
<?php
require_once 'XML/RPC.php';
$qm_server = "209.124.166.74";  // the QueueMetrics server address
$qm_port   = "8080";       // the port QueueMetrics is running on
$qm_webapp = "queuemetrics";  // the webapp name for QueueMetrics

// set which response blocks we are looking for
$req_blocks = new XML_RPC_Value(array(
                        new 
XML_RPC_Value("RealtimeDO.RTRiassunto"),
                        new 
XML_RPC_Value("RealtimeDO.RTCallsBeingProc"),
                        new 
XML_RPC_Value("RealtimeDO.RTAgentsLoggedIn")
                ), 
"array");

// general invocation parameters - see the documentation
$params = array(
                new 
XML_RPC_Value("2253|1919|2222|5555|6666"),
                new 
XML_RPC_Value("robot"),
               new 
XML_RPC_Value("robot"),
                new 
XML_RPC_Value(""),
                new 
XML_RPC_Value(""),
                
$req_blocks
       
);

$msg = new XML_RPC_Message(’QM.realtime’, $params);
$cli = new XML_RPC_Client("/$qm_webapp/xmlrpc.do", $qm_server, $qm_port);
$cli->setDebug(9);
$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( "RealtimeDO.RTRiassunto", $blocks );
    
printBlock( "RealtimeDO.RTCallsBeingProc", $blocks );
    
printBlock( "RealtimeDO.RTAgentsLoggedIn", $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>";
}
?>



Pages: [1]