/*
* This file is part of the WfMOpen project.
* Copyright (C) 2001-2004 Danet GmbH (www.danet.de), GS-AN.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* The initial version of this code has been contributed by Init AG
* (http://www.init-ka.de).
*
* $Id: XmlRpcCall.java 2156 2007-01-24 20:38:41Z mlipp $
*
* $Log$
* Revision 1.2 2006/09/29 12:32:07 drmlipp
* Consistently using WfMOpen as projct name now.
*
* Revision 1.1 2004/09/03 20:00:42 mlipp
* Started adding Scarab interface.
*
*/
package de.danet.an.workflow.tools.scarab;
import java.net.URL;
import java.util.Vector;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
/**
* This class provides a utility that calls SCARAB ScmHandler methods.
*
* @author lgrischancew@init-ka.de
* @created on 22.03.2004
*/
public class XmlRpcCall {
private static final org.apache.commons.logging.Log logger
= org.apache.commons.logging.LogFactory.getLog(XmlRpcCall.class);
public static Object rpc
(String serverUrl, String methodname, Object[] args ) {
Vector v = new Vector();
for(int i = 0; i < args.length; i++) {
v.add(args[i]);
}
try {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(serverUrl));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
return client.execute( methodname, v );
} catch (XmlRpcException e) {
logger.error ("JavaClient: XML-RPC Fault #"
+ Integer.toString(e.code) + ": "
+ e.toString(), e);
return null;
} catch(Throwable t) {
logger.error ("JavaClient: " + t.toString(), t);
return null;
}
}
}