Introduction
Calling a webservice is basically easy in .NET, it is only a matter of adding the webservice as a web reference and using the generated classes. Sometimes you will need to build requests and send them programmatically. In this article we will see you to do it.
Background
Intermediate knowledge in .NET, webservices.
Using the code
string completeUrl ="<a href="http:
WebRequest request = WebRequest.Create(completeUrl);
request.Credentials = CredentialCache.DefaultCredentials;
WebProxy proxyObject = new WebProxy("<a href="http:request.Proxy = proxyObject;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();