Пример #1
0
        public static void SaveObjectsWSDL(KnowledgeBase KB, IOutputService output, bool isSource)
        {
            IEnumerable <KBObject> soapobjs = Utility.GetObjectsSOAP(KB);
            string urlbase = Utility.GetWebRootProperty(KB, "Default");

            foreach (KBObject obj in soapobjs)
            {
                string objqname     = obj.QualifiedName.ModuleName.ToLower() + ".a" + obj.QualifiedName.ObjectName.ToLower();
                string path         = objqname + ".aspx?wsdl";
                string absolutePath = urlbase + path;

                var    http        = (HttpWebRequest)WebRequest.Create(absolutePath);
                var    response    = http.GetResponse();
                var    stream      = response.GetResponseStream();
                var    sr          = new StreamReader(stream);
                var    content     = sr.ReadToEnd();
                string responseuri = response.ResponseUri.ToString();
                string wsdldir     = Utility.WsdlDir(KB, isSource);

                sr.Dispose();
                stream.Dispose();
                //response.Dispose();

                if (responseuri == urlbase + path)
                {
                    KBDoctorOutput.Message(absolutePath + ": OK");
                    string filename = wsdldir + "\\" + objqname + ".wsdl";
                    if (File.Exists(filename))
                    {
                        File.Delete(filename);
                    }
                    File.AppendAllText(filename, content);
                }
                else
                {
                    KBDoctorOutput.Message(absolutePath + ": Requiere login");
                }
            }
        }