protected override void Render(HtmlTextWriter output)
        {
            var operationsPart = new TableTemplate
            {
                Title = "Operations:",
                Items = this.OperationNames,
                ForEachItem = RenderRow
            }.ToString();

            var xsdsPart = new ListTemplate
            {
                Title = "XSDS:",
                ListItemsIntMap = this.Xsds,
                ListItemTemplate = @"<li><a href=""?xsd={0}"">{1}</a></li>"
            }.ToString();

            var wsdlTemplate = new StringBuilder();
            var soap11Config = MetadataConfig.GetMetadataConfig("soap11") as SoapMetadataConfig;
            var soap12Config = MetadataConfig.GetMetadataConfig("soap12") as SoapMetadataConfig;
            if (soap11Config != null || soap12Config != null)
            {
                wsdlTemplate.AppendLine("<h3>WSDLS:</h3>");
                wsdlTemplate.AppendLine("<ul>");
                if (soap11Config != null)
                {
                    wsdlTemplate.AppendFormat(
                        @"<li><a href=""{0}"">{0}</a></li>",
                        soap11Config.WsdlMetadataUri);
                }
                if (soap12Config != null)
                {
                    wsdlTemplate.AppendFormat(
                        @"<li><a href=""{0}"">{0}</a></li>",
                        soap12Config.WsdlMetadataUri);
                }
                wsdlTemplate.AppendLine("</ul>");
            }

            var debugOnlyInfo = new StringBuilder();
            if (EndpointHost.DebugMode)
            {
                debugOnlyInfo.Append("<h3>Debug Info:</h3>");
                debugOnlyInfo.AppendLine("<ul>");
                debugOnlyInfo.AppendLine("<li><a href=\"operations/metadata\">Operations Metadata</a></li>");
                debugOnlyInfo.AppendLine("</ul>");
            }

            var renderedTemplate = HtmlTemplates.Format(
                HtmlTemplates.IndexOperationsTemplate,
                this.Title,
                this.MetadataPageBodyHtml,
                this.XsdServiceTypesIndex,
                operationsPart,
                xsdsPart,
                wsdlTemplate,
                debugOnlyInfo);

            output.Write(renderedTemplate);
        }
Ejemplo n.º 2
0
 protected override void Render(HtmlTextWriter output)
 {
     var operationsPart = new ListTemplate
     {
         ListItems = this.OperationNames,
         ListItemTemplate = @"<li><a href=""?op={0}"">{0}</a></li>"
     }.ToString();
     var renderedTemplate = string.Format(HtmlTemplates.OperationsControlTemplate, 
         this.Title, this.MetadataOperationPageBodyHtml, operationsPart);
     output.Write(renderedTemplate);
 }
        protected override void Render(HtmlTextWriter output)
        {
            var ignoreFormats = EndpointHost.Config.IgnoreFormatsInMetadata;
            var opTemplate = new StringBuilder("<li><span>{0}</span>");
            if (MetadataConfig.Xml != null && !ignoreFormats.Contains("xml"))
                opTemplate.AppendFormat(@"<a href=""../{0}?op={{0}}"">XML</a>", MetadataConfig.Xml.DefaultMetadataUri);
            if (MetadataConfig.Json != null && !ignoreFormats.Contains("json"))
                opTemplate.AppendFormat(@"<a href=""../{0}?op={{0}}"">JSON</a>", MetadataConfig.Json.DefaultMetadataUri);
            if (MetadataConfig.Jsv != null && !ignoreFormats.Contains("jsv"))
                opTemplate.AppendFormat(@"<a href=""../{0}?op={{0}}"">JSV</a>", MetadataConfig.Jsv.DefaultMetadataUri);

            if (MetadataConfig.Custom != null)
            {
                foreach (var format in EndpointHost.Config.ContentTypeFilter.ContentTypeFormats.Keys)
                {
                    if (ignoreFormats.Contains(format)) continue;

                    var uri = string.Format(MetadataConfig.Custom.DefaultMetadataUri, format);
                    opTemplate.AppendFormat(@"<a href=""../{0}?op={{0}}"">{1}</a>", uri, format.ToUpper());
                }
            }

            if (MetadataConfig.Soap11 != null)
                opTemplate.AppendFormat(@"<a href=""../{0}?op={{0}}"">SOAP 1.1</a>", MetadataConfig.Soap11.DefaultMetadataUri);
            if (MetadataConfig.Soap12 != null)
                opTemplate.AppendFormat(@"<a class=""last"" href=""../{0}?op={{0}}"">SOAP 1.2</a>", MetadataConfig.Soap12.DefaultMetadataUri);

            opTemplate.Append("</li>");

            var operationsPart = new ListTemplate {
                Title = "Operations:",
                ListItems = this.OperationNames,
                ForEachListItem = operation => string.Format(opTemplate.ToString(), operation)
            }.ToString();

            var xsdsPart = new ListTemplate {
                Title = "XSDS:",
                ListItemsIntMap = this.Xsds,
                ListItemTemplate = @"<li><a href=""?xsd={0}"">{1}</a></li>"
            }.ToString();

            var wsdlTemplate = new StringBuilder();
            if (MetadataConfig.Soap11 != null || MetadataConfig.Soap12 != null)
            {
                wsdlTemplate.AppendLine("<h3>WSDLS:</h3>");
                wsdlTemplate.AppendLine("<ul>");
                if (MetadataConfig.Soap11 != null)
                {
                    wsdlTemplate.AppendFormat(
                        @"<li><a href=""{0}"">{0}</a></li>",
                        MetadataConfig.Soap11.WsdlMetadataUri);
                }
                if (MetadataConfig.Soap12 != null)
                {
                    wsdlTemplate.AppendFormat(
                        @"<li><a href=""{0}"">{0}</a></li>",
                        MetadataConfig.Soap12.WsdlMetadataUri);
                }
                wsdlTemplate.AppendLine("<ul>");
            }

            var renderedTemplate = string.Format(
                PageTemplate, this.Title, this.UsageExamplesBaseUri, this.XsdServiceTypesIndex,
                operationsPart, xsdsPart, wsdlTemplate);

            output.Write(renderedTemplate);
        }
        protected override void Render(HtmlTextWriter output)
        {
            var opTemplate = new StringBuilder("<li><span>{0}</span>");
            if (MetadataConfig.Xml != null)
                opTemplate.AppendFormat(@"<a href=""../{0}?op={{0}}"">XML</a>", MetadataConfig.Xml.DefaultMetadataUri);
            if (MetadataConfig.Json != null)
                opTemplate.AppendFormat(@"<a href=""../{0}?op={{0}}"">JSON</a>", MetadataConfig.Json.DefaultMetadataUri);
            if (MetadataConfig.Jsv != null)
                opTemplate.AppendFormat(@"<a href=""../{0}?op={{0}}"">JSV</a>", MetadataConfig.Jsv.DefaultMetadataUri);
            if (MetadataConfig.Soap11 != null)
                opTemplate.AppendFormat(@"<a href=""../{0}?op={{0}}"">SOAP 1.1</a>", MetadataConfig.Soap11.DefaultMetadataUri);
            if (MetadataConfig.Soap12 != null)
                opTemplate.AppendFormat(@"<a class=""last"" href=""../{0}?op={{0}}"">SOAP 1.2</a>", MetadataConfig.Soap12.DefaultMetadataUri);

            opTemplate.Append("</li>");

            var operationsPart = new ListTemplate {
                Title = "Operations:",
                ListItems = this.OperationNames,
                ForEachListItem = operation => string.Format(opTemplate.ToString(), operation)
            }.ToString();

            var xsdsPart = new ListTemplate {
                Title = "XSDS:",
                ListItemsIntMap = this.Xsds,
                ListItemTemplate = @"<li><a href=""?xsd={0}"">{1}</a></li>"
            }.ToString();

            var wsdlTemplate = new StringBuilder();
            if (MetadataConfig.Soap11 != null || MetadataConfig.Soap12 != null)
            {
                wsdlTemplate.AppendLine("<h3>WSDLS:</h3>");
                wsdlTemplate.AppendLine("<ul>");
                if (MetadataConfig.Soap11 != null)
                {
                    wsdlTemplate.AppendFormat(
                        @"<li><a href=""{0}"">{0}</a></li>",
                        MetadataConfig.Soap11.WsdlMetadataUri);
                }
                if (MetadataConfig.Soap12 != null)
                {
                    wsdlTemplate.AppendFormat(
                        @"<li><a href=""{0}"">{0}</a></li>",
                        MetadataConfig.Soap12.WsdlMetadataUri);
                }
                wsdlTemplate.AppendLine("<ul>");
            }

            var renderedTemplate = string.Format(
                PageTemplate, this.Title, this.UsageExamplesBaseUri, this.XsdServiceTypesIndex,
                operationsPart, xsdsPart, wsdlTemplate);

            output.Write(renderedTemplate);
        }
Ejemplo n.º 5
0
 protected override void Render(HtmlTextWriter output)
 {
     var operationsPart = new ListTemplate
     {
         ListItems = this.OperationNames,
         ListItemTemplate = @"<li><a href=""?op={0}"">{0}</a></li>"
     }.ToString();
     var renderedTemplate = string.Format(PAGE_TEMPLATE,
         this.Title, this.UsageExamplesBaseUri, operationsPart);
     output.Write(renderedTemplate);
 }