wcfservicewebinvoke

Not able to access any mothod with the attribute [WebInvoke] in WCF Restful services


I am not able to access any method with the attribute [webinvoke] in a RESTful WCF service.

My code is like this:

[OperationContract]
[WebInvoke(Method = "Post", UriTemplate = "Comosite/{composite}", ResponseFormat = WebMessageFormat.Xml)]
CompositeType GetDataUsingDataContract(string composite);        

On executing the above service I am getting an error message

Method not allowed.

I tried many ways, by modifying the urltemplate, method name and method type etc. but nothing is working out.

But if I use the [WebGet] attribute the the service method is working fine.

Can anybody suggest me what can I do make it work?

Thanks in advance... :)


Solution

  • Try changing

    [WebInvoke(Method = "Post", UriTemplate = "Comosite/{composite}", ResponseFormat = WebMessageFormat.Xml)]
    

    to

    [WebInvoke(Method = "POST", UriTemplate = "Comosite/{composite}", ResponseFormat = WebMessageFormat.Xml)]