I recently wrote a post about adding support for generating WADL to an ASP.NET Web API project.
I’ve found myself wanting to demo it a few times, so I’ve packaged it up as a NuGet package to make it easier. This means that it’s also easier for you to add it to your projects :-)
To get started create a new ASP.NET Web API project and add the leeksnet.AspNet.WebApi.Wadl package. This depends on the Microsoft.AspNet.WebApi.HelpPage (>=5.1.0) package that provides the API documentation. This package is added by Visual Studio (from the ASP.NET and Web Tools 2012.2 Update onwards).
After installing the package, build and run the solution and navigate to /Help/Wadl to see the generated output.
You can control which APIs are documented (and therefore included in the WADL output) using the ApiExplorerSettings attribute as shown below. This attribute can be applied at the controller level or the individual action level. E.g.
public class AccountController : ApiController
One small point to note is that when the package is installed it converts the Areas.HelpPage.Controllers.HelpController to be a partial class. This helps to separate out the Wadl action added by the package from the rest of the code.
As always, use it at your own risk (but hopefully it will be useful!)