This project is read-only.

Service does not emit contract namespace

Topics: Web Api
Feb 2, 2012 at 11:45 PM
Edited Feb 2, 2012 at 11:47 PM

I have an existing web service built with WCF/Rest.  I'm working on converting it over to the Web API.
I have a data contract that is accepted as a parameter to an operation.  This contract is decorated with the [DataContract(Namespace="blah...")] attribute.

When I register my route for the service via WCF: RouteTable.Routes.Add(new ServiceRoute(...)) - the xmlns is emitted in the service/help page:
"<MyContract xmlns="blah...">"

However, when I register my route, same exact contract, via Web Api: RouteTable.Routes.MapServiceRoute<MyService>() - the xmlns attribute is not there.


Suffice to say, it causes issues with my clients which pass the xmlns in the request object.

Feb 2, 2012 at 11:46 PM
Edited Feb 2, 2012 at 11:46 PM

Sorry, it crashed when I posted the topic, please use this thread for updates/replies

Feb 3, 2012 at 6:06 PM

I fixed the issue by decorating my contracts with [XmlRoot(Namespace = "MyNamesapce")]

I think it would be great if you could specify your serializers via config.