How to use HttpWebRequest and HttpWebResponse to create a webservice and how will the request and responses will be send across the wire?
2 Answers
this is the syntax for using HttpWebRequest and HttpWebResponse
WebRequest _request; string text; string url = "UrlToGet"; _request = (HttpWebRequest)WebRequest.Create(url); using (WebResponse response = _request.GetResponse()) { using (StreamReader reader =new StreamReader(response.GetResponseStream())) { text = reader.ReadToEnd(); } } 1HttpWebRequest and HttpWebResponse are intended for client applications to make HTTP requests and read HTTP responses. You can't use them to create a server application.
If you want to create and consume SOAP web services using .NET then you need to learn WCF:
WCF is a complex topic but Microsoft still support the legacy "ASP.NET Web Services" technology which might be easier to get a handle on to begin with:
In particular:
5