HttpWebRequest
Besides WebClient, the HttpWebRequest class is another option that
allows web service requests to be made. WebClient offers a simple yet effective API to
invoke and consume web services from Silverlight applications. All calls
made through WebClient are actually
passed through the HttpWebRequest
class under the covers. WebClient is
basically a simplified wrapper on top of HttpWebRequest. You should use the HttpWebRequest class when you require more
granular control over the web service call.
HttpWebRequest exposes
properties that allow customization of the web service call by including
headers through the Headers property
and setting the content type through the ContentType property. Table 7-2 lists some of the
most important members of HttpWebRequest used in invoking web
services.
Table 7-2. Key methods and properties of HttpWebRequest
Methods and events | Type | Description |
|---|---|---|
| Method | Cancels a request made
with |
| Method | Begins the asynchronous request for a stream to send HTTP request data to a service. |
| Method | Begins the asynchronous request for a stream to receive an HTTP response from a service. |
| Method | Method of the base class
|
| Method | Ends the asynchronous request to obtain a stream to send an HTTP request. |
| Method | Ends the asynchronous request to obtain a stream to receive an HTTP response. |
| Property | Gets or sets the ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access