What is the best way to document/publish information on a WCF service in a technical product document that both programmers as well as non-programmers will look at? Also, what is the best tool for publishing.
That's a thorny issue at best! :-)
You could export your WCF service description to a WSDL file and enrich it with <xs:documentation>
and <xs:annotation>
elements, and then convert that to a readable HTML document using an XSLT transformation - but that's less than great and useful, really....
Here's a link that shows how to do that: http://andrewtokeley.net/archive/2008/10/30/adding-wsdl-documentation-to-your-wcf-services.aspx
Several of the XML tools out there also offer ways to document WSDL files - often also from those documentation and annotation tags - one example is here: http://www.oxygenxml.com/doc/ug-oxygen/generate-wsdl-documentation.html
Here's an online version (and a downloadable XSLT transformation) to convert the documentation and annotation elements out of your WSDL: http://tomi.vanek.sk/index.php?page=wsdl-viewer
I don't really have the ultimate answer here - but an avid interest in the topic, too!
Marc
Take a look at this Question: Best way to document a WCF interface.
There is a a help page that is generated when you create a WCF REST Service using the WCF REST Starter Kit. You don't seem to be using REST, but I thought I'd mention it because this format might work well for you.
This uses the Operation Description to expose an Atom Feed of the operations.
A little reflection turned up this sample:
public Atom10FeedFormatter GetFeed(ContractDescription contractDescription)
{
List<SyndicationItem> items = new List<SyndicationItem>();
foreach (OperationDescription od in contractDescription.Description.Operations)
{
WebGetAttribute get = od.Behaviors.Find<WebGetAttribute>();
WebInvokeAttribute invoke = od.Behaviors.Find<WebInvokeAttribute>();
string method = this.GetMethod(get, invoke);
string requestFormat = null;
if (invoke != null)
{
requestFormat = this.GetRequestFormat(invoke, od);
}
string responseFormat = this.GetResponseFormat(get, invoke, od);
string uriTemplate = this.GetUriTemplate(get, invoke, od);
WebMessageBodyStyle bodyStyle = this.GetBodyStyle(get, invoke);
string requestSchemaLink = null;
string responseSchemaLink = null;
string requestExampleLink = null;
string responseExampleLink = null;
if (bodyStyle == WebMessageBodyStyle.Bare)
{
UriTemplate responseSchemaTemplate = new UriTemplate("help/{operation}/response/schema");
responseSchemaLink = responseSchemaTemplate.BindByPosition(this.BaseUri, new string[] { od.Name }).AbsoluteUri;
UriTemplate responseExampleTemplate = new UriTemplate("help/{operation}/response/example");
responseExampleLink = responseExampleTemplate.BindByPosition(this.BaseUri, new string[] { od.Name }).AbsoluteUri;
if (invoke != null)
{
UriTemplate requestSchemaTemplate = new UriTemplate("help/{operation}/request/schema");
requestSchemaLink = requestSchemaTemplate.BindByPosition(this.BaseUri, new string[] { od.Name }).AbsoluteUri;
UriTemplate requestExampleTemplate = new UriTemplate("help/{operation}/request/example");
requestExampleLink = requestExampleTemplate.BindByPosition(this.BaseUri, new string[] { od.Name }).AbsoluteUri;
}
}
uriTemplate = HttpUtility.HtmlEncode(string.Format("{0}/{1}", this.BaseUri.AbsoluteUri, uriTemplate));
string xhtmlDescription = string.Format("<div xmlns=\"http://www.w3.org/1999/xhtml\"><table border=\"5\"><tr><td>UriTemplate</td><td>{0}</td></tr><tr><td>Method</td><td>{1}</td></tr>", uriTemplate, method);
if (!string.IsNullOrEmpty(requestFormat))
{
xhtmlDescription = xhtmlDescription + string.Format("<tr><td>Request Format</td><td>{0}</td></tr>", requestFormat);
}
if (requestSchemaLink != null)
{
xhtmlDescription = xhtmlDescription + string.Format("<tr><td>Request Schema</td><td><a href=\"{0}\">{0}</a></td></tr>", HttpUtility.HtmlEncode(requestSchemaLink));
}
if (requestExampleLink != null)
{
xhtmlDescription = xhtmlDescription + string.Format("<tr><td>Request Example</td><td><a href=\"{0}\">{0}</a></td></tr>", HttpUtility.HtmlEncode(requestExampleLink));
}
xhtmlDescription = xhtmlDescription + string.Format("<tr><td>Response Format</td><td>{0}</td></tr>", responseFormat);
if (responseSchemaLink != null)
{
xhtmlDescription = xhtmlDescription + string.Format("<tr><td>Response Schema</td><td><a href=\"{0}\">{0}</a></td></tr>", HttpUtility.HtmlEncode(responseSchemaLink));
}
if (responseExampleLink != null)
{
xhtmlDescription = xhtmlDescription + string.Format("<tr><td>Response Example</td><td><a href=\"{0}\">{0}</a></td></tr>", HttpUtility.HtmlEncode(responseExampleLink));
}
WebHelpAttribute help = od.Behaviors.Find<WebHelpAttribute>();
if ((help != null) && !string.IsNullOrEmpty(help.Comment))
{
xhtmlDescription = xhtmlDescription + string.Format("<tr><td>Description</td><td>{0}</td></tr>", help.Comment);
}
xhtmlDescription = xhtmlDescription + "</table></div>";
var item = new SyndicationItem() {
Id = "http://tmpuri.org/" + od.Name,
Content = new TextSyndicationContent(xhtmlDescription, TextSyndicationContentKind.XHtml),
LastUpdatedTime = DateTime.UtcNow,
Title = new TextSyndicationContent(string.Format("{0}: {1}", this.Description.Name, od.Name))
};
items.Add(item);
}
SyndicationFeed feed = new SyndicationFeed()
{
Title = new TextSyndicationContent("Service help page"),
LastUpdatedTime = DateTime.UtcNow,
Items = items
};
WebOperationContext.Current.OutgoingResponse.ContentType = "application/atom+xml";
return feed.GetAtom10Formatter();
}