There are two main classes used in Silverlight to access HTTP web services,
WebClient class is suitable for most GET and POST requests and is easier to use than
HttpWebRequest as it
requires less code and due to its event-based model that returns data on the UI thread.
The following example shows how to download a file as a string and write the contents to the debug output.
The following example shows how to download a file as a stream and write the contents to the debug output. Normally you would use either the
XmlReader or the
DataContractJsonSerializer class to work with the response.
The following example shows how to make a POST request, download the result as a string, and write the contents to the debug output.
HttpWebRequest supports a larger subset of the HTTP protocol, but uses a delegate-based callback mechanism and requires
that any calls to the UI thread be marshaled appropriately. Please refer to the Silverlight documentation for details and samples.
Related information on the web is listed below.