Sometimes, it is required that our WCF service be called by some client platform which can only issue plain HTTP GET/POST requests. Or, in .NET framework-based applications, we sometimes might need to use
WebRequest components (under the
System.Net namespace) to consume XML Web Services or WCF services.
In this recipe, we will demonstrate how to use a .NET
WebRequest component to consume an HTTP-based WCF service.
Here we will use a HttpWebRequest component to retrieve some simple text data from a standard WCF service application. Let's take a look at the steps to achieve this:
The sample service here is a very simple one that contains one operation ...