Swaggeratr
Swaggeratr copied to clipboard
Swaggerator with a WCF Rest service question
Hi, We are trying to use Swaggerator with a WCF Rest service that uses routing (System.Web.Routing integration) so that our service can respond to URIs without an extension. Some of our service methods have URI templates like the following:
[WebInvoke(Method = "GET",
RequestFormat = WebMessageFormat.Xml,
ResponseFormat = WebMessageFormat.Xml,
UriTemplate = "{param1}/abc/{param2}/def/{param3}/ghi")]
returnValue DoStuff(string param1, string param2, string param3);
The format of the URI template is causing an exception to be thrown in Swaggerator. The file is Mapper.cs, the method is GetOperations, and the line Uri uri = new Uri("http://base" + uriTemplate); is throwing a UriFormatException with message "Invalid URI: The hostname could not be parsed."
We are assuming this means that Swaggerator doesn't currently support WCF Rest with routing. Is that the case and if so are there any plans to support routing? Thanks!
Can you give me an example of how you have routing configured?
I think it's just the lack of a leading slash in the UriTemplate that's confusing it, but I may be missing something about what you're doing - I've been deep in WebAPI land for a while so it's taking me a minute to dust off my WCF brain. Give this a shot and let me know if it solves your problem.
Adding the leading slash did fix the error. Thank you!