[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] Attempt to use Epinions XML-RPC foiled by ignorance



Adam Williams wrote:

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']"

You can check if the message is in xmlBlaster by typing 'd' to get a dump
or by querying with

java org.xmlBlaster.client.reader.GetMessage -xpath /xmlBlaster/key/wind/speed[ at id='2']

If the message arrives, your get() has problems.
Then try to look into xmlBlaster logs if the get() arrives, start xmlBlaster like this:


java org.xmlBlaster.Main -trace[core] true -call[core] true -cluster.node.id adam

after invoking GetMessage you should see lines like the following

[Oct 1, 2002 9:34:48 AM CALL XmlBlasterImpl-/node/adam] Entering get()
...
[Oct 1, 2002 9:34:48 AM CALL RequestBroker-/node/adam] Entering get(oid='adam-1033457688255-1', queryType='XPATH', query='/xmlBlaster/key/wind/speed[ at id=2]') ...
[Oct 1, 2002 9:34:48 AM TRACE XmlKeyDom] Goin' to query DOM tree with XPATH = /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));
}



regards,

Marcel