01: package org.tigris.scarab.xmlrpc;
02:
03: import java.net.URL;
04: import java.util.Vector;
05:
06: import org.apache.fulcrum.xmlrpc.DefaultXmlRpcClientComponent;
07: import org.apache.fulcrum.xmlrpc.XmlRpcClientComponent;
08:
09: /**
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: public void testXmlRpc() throws Exception {
20: XmlRpcClientComponent cli = new DefaultXmlRpcClientComponent();
21: Vector v = new Vector();
22: v.add("Pacman JVM"); // Module
23: v.add("PAC1"); // IssueID
24: v.add("Administrator"); // User
25: v.add("Prueba pruebilla"); // Comment
26: v.add(new Integer(1)); // DISABLE email sending
27: Vector vRdo = (Vector) cli.executeRpc(new URL(
28: "http://localhost:12345/simple"), "simple.addComment",
29: v);
30: System.out.println("The call was successful: "
31: + (vRdo.size() == 1));
32: System.out.println("The comment was added: " + vRdo.get(0));
33: }
34:
35: public static void main(String args[]) {
36: SimpleHandlerClient shc = new SimpleHandlerClient();
37: try {
38: shc.testXmlRpc();
39: } catch (Exception e) {
40: System.err.println("Error invoking service: " + e);
41: }
42: }
43: }
|