1 # Invoke: perl testpub.pl http://myHost:8080
 2 use Frontier::Client;
 3     
 4 #$server_url = 'http://MyHost:8080/';
 5 $server_url =  @ARGV[0];
 6 print "\nTrying to connect to xmlBlaster server on $server_url ...\n";
 7 
 8 # Make an object to represent the XMLRPC server.
 9 $server = Frontier::Client->new(url => $server_url);
10 
11 $connectQos = "<qos>".
12               "  <securityService type='htpasswd' version='1.0'>".
13               "    <user>testpubUser</user>".
14               "    <passwd>secret</passwd>".
15               "  </securityService>".
16               "  <ptp>true</ptp>".
17               "  <session timeout='86400000' maxSessions='10'/>".
18               "</qos>";
19 
20 # Call the remote server and get our result (we need to port to connect(), see XmlBlaster.pm).
21 $sessionId = $server->call('authenticate.login', "testpubUser", "secret", $connectQos, "");
22 print "\nLogin success on $server_url, got secret sessionId=$sessionId \n";
23 
24 my $publishKey="<key oid='' contentMime='text/xml'>".
25                "  <service>post</service>".
26                "  <type>request</type>".
27                "  <id>123</id>".
28                "</key>",
29 my $cdata="<event>testing</event>";
30 my $publishQos="<qos>".
31                "  <expiration lifeTime='0'/>".
32                "  <persistent>false</persistent>".
33                "  <topic destroyDelay='0' createDomEntry='true'/>".
34                "</qos>";
35 
36 $message = $server->call('xmlBlaster.publish', $sessionId,
37         $publishKey,
38         $cdata,
39         $publishQos);
40 
41 print "publish return is : $message\n";
42 
43 # Logout from xmlBlaster
44 $server->call('authenticate.disconnect', $sessionId, "<qos/>");
45 print "\nLogout done, bye.\n";


syntax highlighted by Code2HTML, v. 0.9.1