I'm trying to rewrite the php demo to use the Epinions XML-RPC module
native to recent versions of PHP. I'm not certain if I am missing
something about how xmlBlaster works, or if I'm just doing something
wrong with the RPC.
My script looks like -
include("../php-classes/xmlrpc_utils.php");
require_once("xmlBlaster.class");
$xb = new xmlBlaster("estate1", 8080, "yoyo", "yaya");
$xb->connect();
echo "SessionID: ";
print_r($xb->get_sessionId());
echo "<br>";
echo "Publish value<br>";
$xb->publish("<key oid='airtraffic.windspeed1' contentMime='text/plain'>
<wind>
<speed id='2' unit='knots'/>
</wind>
</key>", "YOYOMAMA");
echo "Get Value: ";
print_r($xb->query("/xmlBlaster/key/wind/speed[ at id='2']"));
echo "<br>";
echo "Logout";
print_r($xb->logout());
and the publish method looks like -
function publish($key, $doc) {
$qos = '<qos></isDurable></qos>' ;
$messages = xu_rpc_http_concise(
array(
'method' => "xmlBlaster.publish",
'args' => array($this->sessionId, $key, $doc, $qos),
'host' => "estate1",
'uri' => "/",
'port' => 8080
)
);
}
I see in the GUI console that the number of published messages rises
when the script is run (it now stands at 81). Yet the queries result in
-
CALL [RequestBroker-/node/http:192.168.3.1:3412] Entering
get(oid='http_192_168_3_1_3412-1033379994471-58', queryType='XPATH',
query='/xmlBlaster/key/wind/speed[ at id='2']') ...
TRACE [XmlKeyDom] Goin' to query DOM tree with XPATH =
/xmlBlaster/key/wind/speed[ at id='2']
INFO [XmlKeyDom] 0 MessageUnits matched to subscription
"/xmlBlaster/key/wind/speed[ at id='2']"
even if run from the query utility in the GUI console. I copied the key
XML and XPath right from the FAQ, so obviously I'm missing something
about how to get at published messages.
function get($key){
$qos = '<qos></qos>' ;
$messages = xu_rpc_http_concise(
array(
'method' => "xmlBlaster.get",
'args' => array($this->sessionId, $key, $qos),
'host' => "estate1",
'uri' => "/",
'port' => 8080
)
);
return $messages;
} //get
function query($query) {
return $this->get(sprintf("<key oid='' queryType='XPATH'>%s</key>",
$query));
}