I am building my first app for windows application. My requirement is that- On clicking a button i want to navigate to another page and in that page i want the data to be di
You had associate the delegate but you have not called the method. You probably have a method like
KejriwalService.arvindSoapClient.DoSomethingAsync()
This will fire the event and after that it will trigger the client_getarvindNewsCompleted
method when the responde from the WebService comes.
Edit
Just remember to use the [WebMethod]
attribute in you WebService method.
public class Service1 : System.Web.Services.WebService
{
[System.Web.Services.WebMethod]
public string getarvindNews()
{
return "I am a string";
}
}
In you code you call this async like this:
private void button1_Click(object sender, RoutedEventArgs e)
{
KejriwalService.arvindSoapClient client = new arvindSoapClient();
client.getarvindNewsCompleted += new
EventHandler<getarvindNewsCompletedEventArgs>(client_getarvindNewsCompleted);
//Call the method async and get its result in client_getarvindNewsCompleted
client.getarvindNewsAsync();
}
void client_getarvindNewsCompleted(object sender, getarvindNewsCompletedEventArgs e)
{
textBlock1.Text = e.Result.ToString();
}
Just check your web service. Your code is perfect but you need to change your web service. Donot return string from your web method but return the xml