I need to send request to server appending xml data as below to the url of the server
<User>
<MobileNumber>xxxxxxxxxx</MobileNumber>
<UserAgent>yyyyy</UserAgent>
</User>
I will get back response as follows
<User>
<MobileNumber>xxxxxxxxxx</MobileNumber>
<ModelId>zzzzzz</ModelId>
<AuthKey>aaaaaaaaa</AuthKey>
<UserAgent>yyyyy</UserAgent>
</User>
I want to parse the recieved xml data What is the proper way to do this in Windows Phone(7)? first request the url with xml and then receive xml I am new to windows phone development what classes should be used??
I am very confused in - WebClient WebRequest WebResponse HttpWebRequest HttpWebResponse
Edit: I tried the following code to send request, how do I receive the response??
private void Upload()
{
WebClient webClient = new WebClient();
webClient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
var uri = new Uri("xxxxxxxxxx", UriKind.Absolute);
StringBuilder postData = new StringBuilder();
postData.AppendFormat("{0}={1}", "MobileNumber", HttpUtility.UrlEncode("yyyyyyyyy"));
postData.AppendFormat("&{0}={1}", "UserAgent", HttpUtility.UrlEncode("WP7"));
webClient.Headers[HttpRequestHeader.ContentLength] = postData.Length.ToString();
webClient.UploadStringCompleted += new UploadStringCompletedEventHandler(webClient_UploadStringCompleted);
webClient.UploadProgressChanged += webClient_UploadProgressChanged;
webClient.UploadStringAsync(uri, "POST", postData.ToString());
}