Swaggeratr icon indicating copy to clipboard operation
Swaggeratr copied to clipboard

Swaggerator with a WCF Rest service question

Open rmay opened this issue 10 years ago • 3 comments

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!

rmay avatar Apr 24 '14 21:04 rmay

Can you give me an example of how you have routing configured?

superstator avatar Apr 25 '14 01:04 superstator

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.

superstator avatar Apr 25 '14 02:04 superstator

Adding the leading slash did fix the error. Thank you!

rmay avatar Apr 30 '14 17:04 rmay