Skip to content
This repository has been archived by the owner on Mar 21, 2019. It is now read-only.

Swaggerator with a WCF Rest service question #55

Open
rmay opened this issue Apr 24, 2014 · 3 comments
Open

Swaggerator with a WCF Rest service question #55

rmay opened this issue Apr 24, 2014 · 3 comments
Assignees

Comments

@rmay
Copy link

rmay commented Apr 24, 2014

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!

@superstator
Copy link
Owner

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

superstator added a commit that referenced this issue Apr 25, 2014
more careful Uri creation, for cases without absolute paths
superstator added a commit that referenced this issue Apr 25, 2014
more careful Uri creation, for cases without absolute paths
@superstator
Copy link
Owner

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 superstator self-assigned this Apr 25, 2014
@rmay
Copy link
Author

rmay commented Apr 30, 2014

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants