I am trying to create a POST request on a WCF Service to add to server AllocateCreditToken to a specific MSISDN.
I am having a problem that when I start instance of the project and load the URL with the value I want to add, i get a message on the browser saying "Method Not Allowed"
I am not sure if my AllocateCreditToken() method is correct or not.
Please let me know if you need to see the code as it is kind of a long piece of code in that method.
Thanks
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "AllocateCreditToken?MSISDN={MSISDN}")]
Stream AllocateCreditToken(string MSISDN);
Couple of things you should check
1) On WCF service class below attribute is added.
2) You are using message body style as bare which means WCF will not accept more than one parameter.If you wish to pass more than one parameter, set the BodyStyle property to Wrapped.
3) Use POSTMAN tool to send the request to test the response.
Apart from all these here is a short example,notice as it is a restful service I am sending the single value in url itself as part of OData notation. I have not explicitly mentioned message body style as Bare as it defaults to.
and in ajax call