ASP.NET Developer's JumpStart
By Paul D. Sheriff, Ken Getz
Table of Contents
Chapter 30.  Investigating Web Service Consumers

It's easy to call a Web Service method synchronously: Simply create a new instance of the proxy class created for you when you add a Web reference and then call the appropriate method. You will, however, have to wait until the results come back from the Web Service before posting your page, and this may be unacceptable to your users.

If you don't want to wait, you can call a Web Service method asynchronously, as well. It seems like a lot of effort to call a Web Service asynchronously, but it's really just a few more steps. In summary, here's what you must do:

  • Create a "start" procedure that calls the proxy class's BeginXXX procedure, where XXX is the name of the method you want to call in the Web Service. Pass BeginXXX a reference to your "end" procedure so that the .NET Framework can call your procedure when the Web Service has returned a value.

  • Create an "end" procedure to handle the callback from the .NET Framework. In this procedure, call the EndXXX procedure provided by the Web Service proxy class in order to retrieve the return value from the Web Service.


    ASP. NET Developer's JumpStart
    ASP.NET Developers JumpStart
    ISBN: 0672323575
    EAN: 2147483647
    Year: 2002
    Pages: 234 © 2008-2017.
    If you may any questions please contact us: