Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 844577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:18:22+00:00 2026-05-15T06:18:22+00:00

I have an ASP.NET page that needs to make calls to multiple web services

  • 0

I have an ASP.NET page that needs to make calls to multiple web services to return data. I’d like to run these requests in parallel, and using the PageAsyncTask class appears to be the most appropriate way to do that. The trick is that there are five calls–say A, B, C, D, and E. Calls A & B must be made sequentially, as must C & D. The AB pair, the CD pair, and E can all run in parallel.

It doesn’t appear that I can use the “executeInParallel” parameter of the PageAsyncTask constructor to create 5 tasks and get this configuration of parallel/sequential.

I’ve tried creating 3 tasks, two of which have chained asynchronous calls (similar to http://msdn.microsoft.com/en-us/library/dwba7yy7(VS.80).aspx). When I try to do that in the context of a PageAsyncTask, I get an error indicating that the end function can only be called once. I’ve tried wrapping the chained set of 3 functions in a pair of functions that the PageAsyncTask uses, and that results in the end function never being called (thus a timeout).

Is there a good way to do this?

Edit: If it’s useful, here’s a simplified version of the code I’m attempting and getting the error that the end function can only be called once.

     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim objMB As New BusObject.AsyncTasks(AddressOf dummy)
        Dim objTask As New PageAsyncTask(AddressOf objMB.BeginStartSession, AddressOf objMB.EndGetList, Nothing, Nothing, True)
        RegisterAsyncTask(objTask)

        Dim i As Integer = 0
    End Sub

Public Class BusObject
    Public Class AsyncState
        Public SecondCallback As AsyncCallback
    End Class

    Public Class AsyncTasks
        Dim fn_Callback As PageCallback

        Public Delegate Sub PageCallback(ByVal objData As Object)

        Public Sub New(ByVal fnCallback As PageCallback)
            fn_Callback = fnCallback
        End Sub

        Public Function BeginStartSession(ByVal sender As Object, ByVal e As EventArgs, ByVal cb As AsyncCallback, ByVal extraData As Object) As IAsyncResult
            Dim objWS As New com.WebService
            Dim objX As New AsyncState
            objX.SecondCallback = cb
            Return objWS.BeginWSFunction1("param1", "param2", AddressOf EndStartSession, objX)
        End Function

        Public Sub EndStartSession(ByVal objAsyncResult As IAsyncResult)
            Dim objWS As New com.WebService
            Dim strSessionKey As String = objWS.EndWSFunction1(objAsyncResult)
            Dim objState As AsyncState = objAsyncResult.AsyncState

            objWS.BeginWSFunction2("p1", "p2", "p3", "p4", "p5", strSessionKey, True, objState.SecondCallback, objState)

        End Sub

        Public Sub EndGetList(ByVal objState As IAsyncResult)
            Dim objWS As New com.WebService
            Dim objResult As com.WebService.Result = objWS.EndWSFunction2(objState)
            Dim lstReturn As New List(Of BusObject)
            fn_Callback(lstReturn)
        End Sub
    End Class
End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:18:22+00:00Added an answer on May 15, 2026 at 6:18 am

    If anyone runs across the same issue, I was able to make this work by going back to wrapping my chain of calls in a pair of async calls, but then implementing my own IAsyncResult as outlined here: http://msdn.microsoft.com/en-us/magazine/cc163467.aspx

    Then I decided the benefits didn’t justify any potential maintenance/debugging costs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET web page that displays a variety of fields that need
I have an ASP.NET page A that uses a data layer assembly DAL .
I have some ASP.NET page and webservice WebMethod() methods that I'd like to add
ASP.NET newbie question - fastest fingers! I have a page that needs to pull
I have an ASP.Net page that will be hosted on a couple different servers,
I have an ASP.NET page that uses a repeater nested within another repeater to
I'll have an ASP.net page that creates some Excel Sheets and sends them to
I have a very simple ASP.Net page that acts as a front end for
I have an ASP.Net 2.0 page that contains two UpdatePanels. The first panel contains
I have a button on an ASP.Net page that will call Response.Redirect back to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.