#!/usr/bin/perl -w

use Frontier::Daemon;
use Frontier::Client;

sub do_update {
	print "got update\n";
#	exit(1);
	return "<qos><state>OK</state></qos>";
}

sub do_ping {
	print "got ping\n";
	return "<qos><state>OK</state></qos>";
}

my $local_url="http://127.0.0.1:9091/RPC2";
my $server_url=$ARGV[0];

sleep(1);
my $server = Frontier::Client->new(url => $server_url);
print "Connected to xmlBlaster server on $server_url \n";

# Call the remote server and get our result.
my $sessionId = $server->call('authenticate.login', "dk2", "dk2",
		"<qos><callback type='XML-RPC'>$local_url</callback>".
		"<local>false</local></qos>", "");
print "\nLogin success with sessionId=$sessionId \n";

$server->call('xmlBlaster.subscribe',
			$sessionId,
			"<key oid='' queryType='XPATH'>//service</key>",
			"<qos><duplicateUpdates>false</duplicateUpdates></qos>");
#
# Frontier::Daemon must be running to accept the callbacks
# already.
#
