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

  • SEARCH
  • Home
  • 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 6144187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:36:56+00:00 2026-05-23T18:36:56+00:00

I’d like to call two webservices simultaneously and process the responses when both are

  • 0

I’d like to call two webservices simultaneously and process the responses when both are done. I am calling the webservices using Rx’s Observable.FromAsyncPattern method. What is the correct method to simultaneously subscribe to multiple IObservables?

I’ve tried using Zip, but it does not appear to start both simultaneously, only starting the second after the first result is received.
EDIT:
Here’s a demonstration of Zip or some of the other solutions proposed not solving my problem —

class Program
{
    static void Main(string[] args)
    {

        var observable1 = Observable.Create<int>(i =>
            {
                Console.WriteLine("starting 1");
                System.Threading.Thread.Sleep(2000);
                Console.WriteLine("done sleeping 1");
                i.OnNext(1);
                i.OnCompleted();
                return () => { };
            });
        var observable2 = Observable.Create<int>(i =>
        {
            Console.WriteLine("starting 2");
            System.Threading.Thread.Sleep(4000);
            Console.WriteLine("done sleeping 2");
            i.OnNext(1);
            i.OnCompleted();
            return () => { };
        });

        var m = observable1.Zip(observable2, (a, b) => new { a, b });

        var n = Observable.Merge(Scheduler.ThreadPool,
            observable1, observable2);

        var o = Observable.When(observable1.And(observable2).Then((a, b) => new { a, b }));


        m.Subscribe(
            (i) => Console.WriteLine(i),
            () => Console.WriteLine("finished"));

        Console.Read();
    }
}

Results:

starting 1
done sleeping 1
starting 2
done sleeping 2
{ a = 1, b = 1 }
finished

Desired Results:

starting 1
starting 2
done sleeping 1
done sleeping 2
{ a = 1, b = 1 }
finished
  • 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-23T18:36:56+00:00Added an answer on May 23, 2026 at 6:36 pm

    Using the Zip extension method is the simple answer here.

    If you have a couple of typical async calls (assuming single parameter in):

    Func<X1, IObservable<X2>> callX = Observable.FromAsyncPattern<X1, X2>(...);
    Func<Y1, IObservable<Y2>> callY = Observable.FromAsyncPattern<Y1, Y2>(...);
    

    Then you can call both and handle there return values once both are completed like so:

    callX(x1).Zip(callY(y1), (x2, y2) =>
    {
        ...
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.