Is it possible to define two operation contracts with the same paramiters? I want to have the same endpoint do diffrent things on post and get. My code is below
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "MAC/{input}")]
string MAC(string input);
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "MAC/{input}")]
Datalayer.Datacontracts.WebserviceMessage MAC(string input);
With the same name? NO.
Using same parameters as you have mentioned is possible. But not with the same name.
Services follow document-centric paradigm; so when designing services, we should get rid of object oriented thinking. Don’t think about polymorphism, overloading or overriding.
The metadata of the service has to be shared as a document to even non-object oriented systems/platforms (to support interoperability).