Please take a look at MSDN documents first. I will add my thought later.
The WebClient and HttpWebRequest classes can be used for a wide range of HTTP-based programming, from general HTTP requests to programming web and data services.
A Demonstration About How to Consuming Windows Phone Services Series by using WebClint class:
Part 1 - Web Client Basics
Part 2 - HttpWebRequest Fundamentals
Part 3 - Parsing REST based XML Data - Part A - Single Result
Part 4 - Parsing REST based XML Data - Part B - Multiple Results
Another example in 31 Days of Windows Phone | Days #25: Talking to External APIs
The following table shows which classes can be used for the various types of HTTP-based programming:
- WebClient Class: Provides common methods for sending data to and receiving data from a URI-based resource.
- HttpWebRequest Class: Provides an HTTP-specific implementation of the abstract WebRequest class.
- Silverlight Service Model Proxy Generation Tool (SLsvcUtil.exe): Generates proxy classes based on a web service WSDL file.
- Visual Studio Add Service Reference Feature: Generates proxy classes based on either a web service WSDL file or a data service CSDL file.
- WCF Data Service Client Utility (DataSvcUtil.exe): Generates proxy classes based on a data service CSDL file.
Class | General HTTP programming | HTTP-based web service | Data service |
---|---|---|---|
WebClient class | yes | yes | yes |
HttpWebRequest class | yes | yes | yes |
SLsvcUtil.exe generated classes | no | yes | no |
Add Service Reference feature generated classes | no | yes | yes |
DataSvcUtil.exe generated classes | no | no | yes |
No comments:
Post a Comment