| Author: Naganathan 24 Oct 2009 | Member Level: Bronze | Rating:  Points: 2 |
using callback function and delegates we can consume webservice asynchronously .
Regards, Naganathan
|
| Author: Chandru 28 Oct 2009 | Member Level: Silver | Rating:  Points: 2 |
Try to use ajax goto http://netprogramminghelp.com,you can find article.
Chandru SilverlightScripting.com
|
| Author: Joby 17 Nov 2009 | Member Level: Bronze | Rating:  Points: 2 |
The method which invok the webservice private void button1_Click(object sender, System.EventArgs e) { peter.Service1 ws = new CSharpTester.peter.Service1(); //GetDataSet() is the method in the webservice. Webservice //automatically expose BeginGetDataSet() and EndGetDataSet() for my //GetDataSet() method. Intellisence will give you both these method //when ur typying the webservice object.(here ws.) //"Testing 1234" is the parameter whis is expected by webmethod //WsCallback is the callback method given below, which is defined by //me ws.BeginGetDataSet("Testing 1234",new AsyncCallback(WsCallback),ws); }
private void WsCallback( IAsyncResult ar) { //Create an object of wesrvice of callback method's IAsyncResult //param peter.Service1 ws = (peter.Service1)ar.AsyncState; //EndGetDataSet() is exposed by system itself. DataSet ds = ws.EndGetDataSet(ar); private void button1_Click(object sender, System.EventArgs e) { peter.Service1 ws = new CSharpTester.peter.Service1(); ws.BeginGetDataSet("Testing 1234",new AsyncCallback(WsCallback),ws); }
private void WsCallback( IAsyncResult ar) { peter.Service1 ws = (peter.Service1)ar.AsyncState; //The webmethod GetDataSet() is returning a dataset. DataSet ds = ws.EndGetDataSet(ar); //Just assigning the value to label this.label1.Text=(string)ds.Tables[0].Rows[0]["test"]; }
|