1, the definition of servicecontract and implementation
[ServiceContract] Public InterfaceImemberservice {[OperationContract]stringGetData (intvalue); [OperationContract] Compositetype getdatausingdatacontract (Compositetype composite); [OperationContract] [WebInvoke (Method="POST", UriTemplate ="/create", Responseformat = Webmessageformat.json, Requestformat = Webmessageformat.json, bodystyle =webmessagebodystyle.wrapped)]stringCreatemember (Member Member); [OperationContract] [WebGet (UriTemplate=" All")] stringGetAll (); //TODO: Add your service actions here}
2. svc file
<% @ServiceHost language=c# debug="true" service=" Webapplication1.memberservice" factory=" System.ServiceModel.Activation.WebServiceHostFactory"%>
3. Fiddler test
Request Headers:user-agent:fiddlercontent-type:application/json;charset=utf-8Host:localhost:4087Content-length: $requestbody:{"member":{"ID":"Brett","Name":"McLaughlin"}}