I'm tired of getting POST data with WCF (I'm a newbie) so I really don't know what am I doing wrong. I'm trying to send POST data with this form:
<!doctype html>
<html>
<head></head>
<body>
<form action='http://localhost:56076/Service.svc/invoke' method="post" target="_blank">
<label for="firstName">First Name</label>: <input type="text" name="firstName" value="" />
<label for="lastName">Last Name</label>: <input type="text" name="lastName" value="" />
<input type="submit" />
</form>
</body>
</html>
And I'm using WCF Service Application (in VS2008):
//IService.cs: [ServiceContract] public interface IService { [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "invoke", BodyStyle = WebMessageBodyStyle.WrappedRequest)] string GetData(Stream aoInput); }
//Service.svc.cs public class Service : IService { public string GetData(Stream aoInput) { using (StreamReader loReader = new StreamReader(aoInput)) { string body = loReader.ReadToEnd(); var @params = HttpUtility.ParseQueryString(body); return @params["FirstName"]; } } }
While service executes after I press submit on the form I have no response from the breakpoints in my code. What am I doing wrong?