The WebService method is called asynchronously!

Source: Internet
Author: User
The WebService method does not need to be modified, but uses an Asynchronous Method During the call. In this way, the speed will be faster in the loop.

Original method:

Using magweb.com. china_sms.www.MainServices sms = new using magweb.com. china_sms.www.MainServices (); // instantiate an object
String sSendRes = sms. massSend (); // call the method directly

Now you can change it to asynchronous call method: HotelMagWeb.com. china_sms.www.MainServices sms = new domains magweb.com. china_sms.www.MainServices (); // The same instantiation object
Sms. BeginmassSend (new AsyncCallback (MySMS), sms); // use the method starting with Begin to pass in a method (my name is MySMS)

// Implement real calls and results in this method!
Public static void MySMS (IAsyncResult iar)
{
Using magweb.com. china_sms.www.MainServices sms = (using magweb.com. china_sms.www.MainServices) iar. AsyncState;
String sSendRes = sms. EndmassSend (iar );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.