KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tigris > scarab > util > SimpleHandlerClient


1 package org.tigris.scarab.util;
2
3 import java.net.URL JavaDoc;
4 import java.util.Vector JavaDoc;
5
6 import org.apache.fulcrum.xmlrpc.DefaultXmlRpcClientComponent;
7 import org.apache.fulcrum.xmlrpc.XmlRpcClientComponent;
8
9 /**
10  * This class is just an example of invoking the SimpleHandler class via
11  * the XmlRpc service.
12  *
13  * @author jorgeuriarte
14  * @see org.tigris.scarab.util.SimpleHandler
15  *
16  */

17 public class SimpleHandlerClient
18 {
19
20     public void testXmlRpc() throws Exception JavaDoc
21     {
22         XmlRpcClientComponent cli = new DefaultXmlRpcClientComponent();
23         Vector JavaDoc v = new Vector JavaDoc();
24         v.add("Pacman JVM"); // Module
25
v.add("PAC1"); // IssueID
26
v.add("Administrator"); // User
27
v.add("Prueba pruebilla"); // Comment
28
v.add(new Integer JavaDoc(1)); // DISABLE email sending
29
Vector JavaDoc vRdo = (Vector JavaDoc)cli.executeRpc(new URL JavaDoc("http://localhost:12345/simple"), "simple.addComment", v);
30         System.out.println("The call was successful: " + (vRdo.size()==1));
31         System.out.println("The comment was added: " + vRdo.get(0));
32     }
33     
34     public static void main(String JavaDoc args[])
35     {
36         SimpleHandlerClient shc = new SimpleHandlerClient();
37         try
38         {
39             shc.testXmlRpc();
40         }
41         catch (Exception JavaDoc e)
42         {
43             System.err.println("Error invoking service: " + e);
44         }
45     }
46 }
Popular Tags