Click here to Skip to main content
16,016,168 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Dear:

I am developing a Restful service in C# and working well when I us
C#
[OperationContract]
        [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "json/?id={id}")]
        string jdata(string id);

and my corrsponding function implementation is:

public string json(string id)
{
     return "You Typed : "+id;
}


Up to here all works well,
but when I change WenInvoke Method="POST" I have to face a "Method NOT Allowed.";

C#
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "json/?id={id}")]
        string jdata(string id);



Please Reply to resolve my problem.
Thanks.
Posted

1 solution

try using
C#
BodyStyle = WebMessageBodyStyle.Bare,ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900