public override DekiScriptLiteral InvokeMap(DekiScriptRuntime runtime, DekiScriptMap args) {

            // prepare uri for invocation
            Plug plug = Plug.New(_endpoint);
            plug = runtime.PreparePlug(plug);

            // make web-request
            DreamMessage response = plug.Post(args.ToXml(), new Tasking.Result<DreamMessage>()).Wait();
            if(!response.IsSuccessful) {
                if(response.HasDocument) {
                    var error = response.ToDocument();
                    var message = error["message"];
                    if(error.HasName("exception") && !message.IsEmpty) {
                        throw new DekiScriptRemoteException(Location.None, message.Contents);
                    }
                }
                throw new DreamResponseException(response);
            }

            // convert response to literal
            DekiScriptLiteral list;
            try {
                list = DekiScriptLiteral.FromXml(response.ToDocument());
            } catch(ArgumentException) {
                throw new DekiScriptUnsupportedTypeException(Location.None, string.Format("<{0}>", response.ToDocument().Name));
            }
            if(list.ScriptType != DekiScriptType.LIST) {
                throw new DekiScriptBadTypeException(Location.None, list.ScriptType, new[] { DekiScriptType.LIST });
            }
            return ((DekiScriptList)list)[0];
        }
        //--- Methods ---
        public override DekiScriptLiteral InvokeList(DekiScriptRuntime runtime, DekiScriptList args)
        {
            // prepare uri for invocation
            Plug plug = Plug.New(_endpoint);

            plug = runtime.PreparePlug(plug);
            DreamMessage response = plug.Post(DekiScriptToXmlRpc(_methodname, args));

            // convert response to literal
            DekiScriptLiteral list = FromXmlRpcToDekiScript(response.ToDocument());

            if (list.ScriptType != DekiScriptType.LIST)
            {
                throw new DekiScriptBadReturnTypeException(Location.None, list.ScriptType, new[] { DekiScriptType.LIST });
            }
            return(((DekiScriptList)list)[0]);
        }
        public override DekiScriptLiteral InvokeMap(DekiScriptRuntime runtime, DekiScriptMap args) {

            // prepare uri for invocation
            Plug plug = Plug.New(_endpoint);
            plug = runtime.PreparePlug(plug);

            // invoke function
            DreamMessage response = plug.Get();

            // convert response to literal
            DekiScriptLiteral list;
            try {
                list = DekiScriptLiteral.FromXml(response.ToDocument());
            } catch(ArgumentException) {
                throw new DekiScriptUnsupportedTypeException(Location.None, string.Format("<{0}>", response.ToDocument().Name));
            }
            if(list.ScriptType != DekiScriptType.LIST) {
                throw new DekiScriptBadReturnTypeException(Location.None, list.ScriptType, new[] { DekiScriptType.LIST });
            }
            return ((DekiScriptList)list)[0];
        }
        public override DekiScriptLiteral InvokeMap(DekiScriptRuntime runtime, DekiScriptMap args)
        {
            // prepare uri for invocation
            Plug plug = Plug.New(_endpoint);

            plug = runtime.PreparePlug(plug);

            // make web-request
            DreamMessage response = plug.Post(args.ToXml(), new Tasking.Result <DreamMessage>()).Wait();

            if (!response.IsSuccessful)
            {
                if (response.HasDocument)
                {
                    var error   = response.ToDocument();
                    var message = error["message"];
                    if (error.HasName("exception") && !message.IsEmpty)
                    {
                        throw new DekiScriptRemoteException(Location.None, message.Contents);
                    }
                }
                throw new DreamResponseException(response);
            }

            // convert response to literal
            DekiScriptLiteral list;

            try {
                list = DekiScriptLiteral.FromXml(response.ToDocument());
            } catch (ArgumentException) {
                throw new DekiScriptUnsupportedTypeException(Location.None, string.Format("<{0}>", response.ToDocument().Name));
            }
            if (list.ScriptType != DekiScriptType.LIST)
            {
                throw new DekiScriptBadTypeException(Location.None, list.ScriptType, new[] { DekiScriptType.LIST });
            }
            return(((DekiScriptList)list)[0]);
        }
        public override DekiScriptLiteral InvokeMap(DekiScriptRuntime runtime, DekiScriptMap args)
        {
            // prepare uri for invocation
            Plug plug = Plug.New(_endpoint);

            plug = runtime.PreparePlug(plug);

            // invoke function
            DreamMessage response = plug.Get();

            // convert response to literal
            DekiScriptLiteral list;

            try {
                list = DekiScriptLiteral.FromXml(response.ToDocument());
            } catch (ArgumentException) {
                throw new DekiScriptUnsupportedTypeException(Location.None, string.Format("<{0}>", response.ToDocument().Name));
            }
            if (list.ScriptType != DekiScriptType.LIST)
            {
                throw new DekiScriptBadReturnTypeException(Location.None, list.ScriptType, new[] { DekiScriptType.LIST });
            }
            return(((DekiScriptList)list)[0]);
        }
        //--- Methods ---
        public override DekiScriptLiteral InvokeList(DekiScriptRuntime runtime, DekiScriptList args) {

            // prepare uri for invocation
            Plug plug = Plug.New(_endpoint);
            plug = runtime.PreparePlug(plug);
            DreamMessage response = plug.Post(DekiScriptToXmlRpc(_methodname, args));

            // convert response to literal
            DekiScriptLiteral list = FromXmlRpcToDekiScript(response.ToDocument());
            if(list.ScriptType != DekiScriptType.LIST) {
                throw new DekiScriptBadReturnTypeException(Location.None, list.ScriptType, new[] { DekiScriptType.LIST });
            }
            return ((DekiScriptList)list)[0];
        }