Support for HttpClient and HttpGet in WP7

I am creating an application that is already built into Android and another mobile platform. Since the application uses the built-in REST web services in JAVA, so I need to use this Webservice URL. The code uses HttpClient and HttpGet for GET, POST, PUT and DELETE in Android. Can anyone guide me where to start as I am new to this platform.

0
source share
3 answers

I would recommend using the WebClient class for simple HTTP communication. Here is the basic format that I usually use when accessing a web service:

WebClient web = new WebClient();
web.OpenReadCompleted += new OpenReadCompletedEventHandler(RequestComplete);
web.OpenReadAsync(new Uri("http://fullurlofyourwebservice.com"));

Then you can write the RequestComplete method method mentioned in the second line of code:

void RequestComplete(object sender, OpenReadCompletedEventArgs e)
        {
            string response = "";

            using (var reader = new StreamReader(e.Result))
            {
                response = reader.ReadToEnd();
            }
        }

- XDocument.Parse(response), XML.

MSDN .

+2

RestSharp. http://restsharp.org/

, , .

0

All Articles