diff --git a/src/helma/scripting/fesi/extensions/XmlRpcExtension.java b/src/helma/scripting/fesi/extensions/XmlRpcExtension.java
new file mode 100644
index 00000000..56c959d9
--- /dev/null
+++ b/src/helma/scripting/fesi/extensions/XmlRpcExtension.java
@@ -0,0 +1,140 @@
+// XmlRpcExtension.java
+// Copyright (c) Hannes Wallnöfer, 1999 - All rights reserved
+
+package helma.scripting.fesi.extensions;
+
+import org.apache.xmlrpc.*;
+
+import helma.scripting.fesi.FesiEvaluator;
+
+import FESI.Interpreter.*;
+import FESI.Exceptions.*;
+import FESI.Extensions.*;
+import FESI.Data.*;
+
+import java.io.*;
+import java.util.*;
+import java.net.*;
+
+
+/**
+ * An extension to transparently call and serve XML-RPC from the
+ * FESI EcmaScript interpreter.
+ * The extension adds constructors for XML-RPC clients and servers to the Global Object.
+ * For more information on how to use this please look at the files server.es and
+ * client.es in the src/fesi directory of the distribution.
+ *
+ * All argument conversion is done automatically. Currently the following argument and return
+ * types are supported:
+ *
+ * - plain objects (with all properties returned by ESObject.getProperties ())
+ *
- arrays
+ *
- strings
+ *
- date objects
+ *
- booleans
+ *
- integer and float numbers (long values are not supported!)
+ *
+ *
+ */
+public class XmlRpcExtension extends Extension {
+
+ Evaluator evaluator;
+ ESObject op;
+
+ public void initializeExtension (Evaluator evaluator) throws EcmaScriptException {
+ // XmlRpc.setDebug (true);
+ this.evaluator = evaluator;
+ GlobalObject go = evaluator.getGlobalObject();
+ FunctionPrototype fp = (FunctionPrototype) evaluator.getFunctionPrototype();
+
+ op = evaluator.getObjectPrototype();
+
+ go.putHiddenProperty ("Remote", new GlobalObjectRemote ("Remote", evaluator, fp)); // the Remote constructor
+ }
+
+
+ class GlobalObjectRemote extends BuiltinFunctionObject {
+
+ GlobalObjectRemote (String name, Evaluator evaluator, FunctionPrototype fp) {
+ super(fp, evaluator, name, 1);
+ }
+
+ public ESValue callFunction(ESObject thisObject, ESValue[] arguments) throws EcmaScriptException {
+ return doConstruct(thisObject, arguments);
+ }
+
+ public ESObject doConstruct(ESObject thisObject, ESValue[] arguments) throws EcmaScriptException {
+ ESObject remote = null;
+ String url = null;
+ String robj = null;
+ if (arguments.length >= 1)
+ url = arguments[0].toString ();
+ if (arguments.length >= 2)
+ robj = arguments[1].toString ();
+ try {
+ remote = new ESRemote (op, this.evaluator, url, robj);
+ } catch (MalformedURLException x) {
+ throw new EcmaScriptException (x.toString ());
+ }
+ return remote;
+ }
+ }
+
+
+ class ESRemote extends ObjectPrototype {
+
+ URL url;
+ String remoteObject;
+
+ public ESRemote (ESObject prototype, Evaluator evaluator, String urlstring, String robj) throws MalformedURLException {
+ super (prototype, evaluator);
+ this.url = new URL (urlstring);
+ remoteObject = robj;
+ }
+
+ public ESRemote (ESObject prototype, Evaluator evaluator, URL url, String robj) {
+ super (prototype, evaluator);
+ this.url = url;
+ remoteObject = robj;
+ }
+
+ public ESValue doIndirectCall(Evaluator evaluator, ESObject target, String functionName, ESValue arguments[])
+ throws EcmaScriptException, NoSuchMethodException {
+ // System.out.println ("doIndirectCall called with "+functionName);
+ XmlRpcClient client = new XmlRpcClient (url);
+ // long now = System.currentTimeMillis ();
+ Object retval = null;
+ int l = arguments.length;
+ Vector v = new Vector ();
+ for (int i=0; i