01: /*
02: * This file is part of the WfMOpen project.
03: * Copyright (C) 2001-2004 Danet GmbH (www.danet.de), GS-AN.
04: * All rights reserved.
05: *
06: * This program is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU General Public License as published by
08: * the Free Software Foundation; either version 2 of the License, or
09: * (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: *
20: * The initial version of this code has been contributed by Init AG
21: * (http://www.init-ka.de).
22: *
23: * $Id: XmlRpcCall.java,v 1.3 2007/01/24 20:38:41 mlipp Exp $
24: *
25: * $Log: XmlRpcCall.java,v $
26: * Revision 1.3 2007/01/24 20:38:41 mlipp
27: * Updated xmlrpc.jar.
28: *
29: * Revision 1.2 2006/09/29 12:32:07 drmlipp
30: * Consistently using WfMOpen as projct name now.
31: *
32: * Revision 1.1 2004/09/03 20:00:42 mlipp
33: * Started adding Scarab interface.
34: *
35: */
36: package de.danet.an.workflow.tools.scarab;
37:
38: import java.net.URL;
39: import java.util.Vector;
40:
41: import org.apache.xmlrpc.XmlRpcException;
42: import org.apache.xmlrpc.client.XmlRpcClient;
43: import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
44:
45: /**
46: * This class provides a utility that calls SCARAB ScmHandler methods.
47: *
48: * @author lgrischancew@init-ka.de
49: * @created on 22.03.2004
50: */
51: public class XmlRpcCall {
52:
53: private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory
54: .getLog(XmlRpcCall.class);
55:
56: public static Object rpc(String serverUrl, String methodname,
57: Object[] args) {
58: Vector v = new Vector();
59: for (int i = 0; i < args.length; i++) {
60: v.add(args[i]);
61: }
62:
63: try {
64: XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
65: config.setServerURL(new URL(serverUrl));
66: XmlRpcClient client = new XmlRpcClient();
67: client.setConfig(config);
68: return client.execute(methodname, v);
69: } catch (XmlRpcException e) {
70: logger
71: .error("JavaClient: XML-RPC Fault #"
72: + Integer.toString(e.code) + ": "
73: + e.toString(), e);
74: return null;
75: } catch (Throwable t) {
76: logger.error("JavaClient: " + t.toString(), t);
77: return null;
78: }
79: }
80: }
|