I have an operation contract (below) that I want to allow GET and POST requests against. How can I tell WCF to accept both types of requests for a single OperationContract?
[OperationContract, WebInvoke(Method='POST', BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, UriTemplate = 'query')] XElement Query(string qry); [OperationContract, WebInvoke(Method='GET', BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, UriTemplate = 'query?query={qry}')] XElement Query(string qry);
This post over on the MSDN Forums by Carlos Figueira has a solution. I’ll go with this for now but if anyone else has any cleaner solutions let me know.