Hello
I have a WCF restul service and I want to allow the user to choose what request format they want, i have the decorations
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "getstreamurl?ch={ch}&format=xml")]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "getstreamurl?ch={ch}&format=json")]
First of, is there a way to specify the ResponseFormat at runtime and take the format in as an argument to the method? From reading around i dont think so... OK next thing The above code is ok and works, but im having a problem, i want to be able to specify a default, so when no format arguement is passed then i just default but if i decorate like so
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "getstreamurl?ch={ch})]
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "getstreamurl?ch={ch}&format=json")]
Where the XML is the default, if i try to call the service method through the browser it tells me that: UriTemplateTable does not support multiple templates that have equivalent path as template 'getstreamurl?ch={ch}' but have different query strings, where the query strings cannot all be disambiguated via literal values. See the documentation for UriTemplateTable for more detail They obviously can be distinguished but it seems that WCF is only reading up to the argument and thats it...Any suggestions?