NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Requesting Data

Developing applications that run in a distributed operating environment like today’s Internet requires an efficient, easy-to-use method for retrieving data from resources of all types. Pluggable protocols let you develop applications that use a single interface to retrieve data using multiple Internet protocols.

Client applications request data from servers using the WebRequest class and its descendents. The WebRequest class encapsulates the details of connecting to the server, sending the request, and receiving the response. WebRequest is an abstract class that defines a set of properties and methods that are available to all applications using pluggable protocols. Descendents of WebRequest, such as HttpWebRequest, implement the properties and methods defined by WebRequest in a way that is consistent with the underlying protocol.

The WebRequestFactory class creates protocol-specific instances of WebRequest descendents using the value of the URI passed to its Create method to determine the specific derived class instance to create.

The request is made to the Internet resource by calling the GetResponse method on the WebRequest instance. The GetResponse method returns a WebResponse derived instance that matches the WebRequest derived instance.

WebRequest req = WebRequestFactory.Create("http://www.microsoft.com/");
WebResponse resp = req.GetResponse();