Beispiel #1
0
        public Array System__Method__Signature___(string MethodName)
        {
            //TODO: support overloaded methods
            XmlRpcServiceInfo svcInfo = XmlRpcServiceInfo.CreateServiceInfo(
                this.GetType());
            XmlRpcMethodInfo mthdInfo = svcInfo.GetMethod(MethodName);

            if (mthdInfo == null)
            {
                throw new XmlRpcFaultException(880,
                                               "Request for information on unsupported method");
            }
            if (mthdInfo.IsHidden)
            {
                throw new XmlRpcFaultException(881,
                                               "Information not available on this method");
            }
            //XmlRpcTypes.CheckIsXmlRpcMethod(mi);
            ArrayList alist = new ArrayList();

            alist.Add(XmlRpcServiceInfo.GetXmlRpcTypeString(mthdInfo.ReturnType));
            foreach (XmlRpcParameterInfo paramInfo in mthdInfo.Parameters)
            {
                alist.Add(XmlRpcServiceInfo.GetXmlRpcTypeString(paramInfo.Type));
            }
            string[]  types    = (string[])alist.ToArray(typeof(string));
            ArrayList retalist = new ArrayList();

            retalist.Add(types);
            Array retarray = retalist.ToArray(typeof(string[]));

            return(retarray);
        }
Beispiel #2
0
        public static void WriteDoc(HtmlTextWriter wrtr, Type type,
                                    bool autoDocVersion)
        {
            XmlRpcServiceInfo svcInfo = XmlRpcServiceInfo.CreateServiceInfo(type);

            wrtr.WriteFullBeginTag("html");
            wrtr.WriteLine();
            WriteHead(wrtr, svcInfo.Name);
            wrtr.WriteLine();
            WriteBody(wrtr, type, autoDocVersion);
            wrtr.WriteEndTag("html");
        }
Beispiel #3
0
        public string[] System__List__Methods___()
        {
            XmlRpcServiceInfo svcInfo = XmlRpcServiceInfo.CreateServiceInfo(
                this.GetType());
            ArrayList alist = new ArrayList();

            foreach (XmlRpcMethodInfo mthdInfo in svcInfo.Methods)
            {
                if (!mthdInfo.IsHidden)
                {
                    alist.Add(mthdInfo.XmlRpcName);
                }
            }
            return((String[])alist.ToArray(typeof(string)));
        }
Beispiel #4
0
        Header[] GetChannelHeaders(
            ITransportHeaders requestHeaders,
            XmlRpcRequest xmlRpcReq,
            Type svcType)
        {
            string            requestUri = (string)requestHeaders["__RequestUri"];
            XmlRpcServiceInfo svcInfo    = XmlRpcServiceInfo.CreateServiceInfo(svcType);
            ArrayList         hdrList    = new ArrayList();

            hdrList.Add(new Header("__Uri", requestUri));
            hdrList.Add(new Header("__TypeName", svcType.AssemblyQualifiedName));
            hdrList.Add(new Header("__MethodName",
                                   svcInfo.GetMethodName(xmlRpcReq.method)));
            hdrList.Add(new Header("__Args", xmlRpcReq.args));
            return((Header[])hdrList.ToArray(typeof(Header)));
        }
Beispiel #5
0
        public string System__Method__Help___(string MethodName)
        {
            //TODO: support overloaded methods?
            XmlRpcServiceInfo svcInfo = XmlRpcServiceInfo.CreateServiceInfo(
                this.GetType());
            XmlRpcMethodInfo mthdInfo = svcInfo.GetMethod(MethodName);

            if (mthdInfo == null)
            {
                throw new XmlRpcFaultException(880,
                                               "Request for information on unsupported method");
            }
            if (mthdInfo.IsHidden)
            {
                throw new XmlRpcFaultException(881,
                                               "Information not available for this method");
            }
            return(mthdInfo.Doc);
        }
Beispiel #6
0
        public static void WriteType(
            HtmlTextWriter wrtr,
            Type type)
        {
            ArrayList structs = new ArrayList();

            wrtr.WriteBeginTag("div");
            wrtr.WriteAttribute("id", "content");
            wrtr.Write(HtmlTextWriter.TagRightChar);
            wrtr.WriteLine();

            XmlRpcServiceInfo svcInfo =
                XmlRpcServiceInfo.CreateServiceInfo(type);

            wrtr.WriteBeginTag("p");
            wrtr.WriteAttribute("class", "heading1");
            wrtr.Write(HtmlTextWriter.TagRightChar);
            wrtr.Write(svcInfo.Name);
            wrtr.WriteEndTag("p");
            wrtr.WriteFullBeginTag("br");
            wrtr.WriteEndTag("br");
            wrtr.WriteLine();

            if (svcInfo.Doc != "")
            {
                wrtr.WriteBeginTag("p");
                wrtr.WriteAttribute("class", "intro");
                wrtr.Write(HtmlTextWriter.TagRightChar);
                wrtr.Write(svcInfo.Doc);
                wrtr.WriteEndTag("p");
                wrtr.WriteLine();
            }
            wrtr.WriteBeginTag("p");
            wrtr.WriteAttribute("class", "intro");
            wrtr.Write(HtmlTextWriter.TagRightChar);
            wrtr.Write("The following methods are supported:");
            wrtr.WriteEndTag("p");
            wrtr.WriteLine();

            wrtr.WriteFullBeginTag("ul");
            wrtr.WriteLine();
            foreach (XmlRpcMethodInfo mthdInfo in svcInfo.Methods)
            {
                if (!mthdInfo.IsHidden)
                {
                    wrtr.WriteFullBeginTag("li");
                    wrtr.WriteBeginTag("a");
                    wrtr.WriteAttribute("href", "#" + mthdInfo.XmlRpcName);
                    wrtr.Write(HtmlTextWriter.TagRightChar);
                    wrtr.Write(mthdInfo.XmlRpcName);
                    wrtr.WriteEndTag("a");
                    wrtr.WriteEndTag("li");
                    wrtr.WriteLine();
                }
            }

            wrtr.WriteEndTag("ul");
            wrtr.WriteLine();

            foreach (XmlRpcMethodInfo mthdInfo in svcInfo.Methods)
            {
                if (mthdInfo.IsHidden == false)
                {
                    WriteMethod(wrtr, mthdInfo, structs);
                }
            }

            for (int j = 0; j < structs.Count; j++)
            {
                WriteStruct(wrtr, structs[j] as Type, structs);
            }

            wrtr.WriteEndTag("div");
            wrtr.WriteLine();
        }