locked
ASP.NET Design Question RRS feed

  • Question

  • User1648846820 posted

    I'm using ASP.NET 3.5.

    I've a page, say page1.aspx, in my application. I need to aggregate data from 4 different services (external to application) and show the data on the page. Of these 4 services, 2 are WCF services, 1 is an asmx service and 1 is exposed over plain HTTP (HTTPRequest and response).

    The way my page layout will be defined is that I will have multiple areas in the page. Each area will display data from one or more services above. E.g. Area1 on the page will aggregate data from, say WCFService1 and WCFService2. Similarly, Area2 will display data aggregated from WCFService2 and ASMXService.

    The requirement here is that when the data fetch should start only after the page loads i.e. my page should load first, and then in the background data should be fetched from the various services above. As soon as my page loads, there will be rotating progress bars in each of the areas. As and when data is recieved for those areas, the data will be displayed.

    How can this be achieved?

    AFIK, this definitely can't be done with server-side coding. I will have to write javascript code to invoke these services and aggregate data. Any pointers will be deeply appreciated

    Wednesday, April 28, 2010 1:04 AM

Answers

  • User1146730029 posted

    This idea is quite complicated, but .....

    1. Create the page as a single page with all the services - just to make sure everything works. Doesnt matter if it takes a long time to load.

    2. Change the code so that the services do not load on page load.

    3. Put each of the outputs from the services in an AJAX panel.

    4. Put a hidden button in each of the AJAX Panels.

    5. Write some javascript that will push the hidden buttons at set intervals.

    6. In the code behind for each of the hidden buttons, actually start a thread and load the services in the thread. Pass back either a 'in progress' message, or the actual results of the services.

    I have seen this being done before, but it was complicated. I am sure there is an easy way. Have a quick search for ASP.NET and Threading, I'm sure you will find some articles in Google.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 28, 2010 11:45 AM

All replies

  • User1146730029 posted

    I am not 100% sure on this - but here is an idea.

    First create 4 pages for each of the 4 services. Each page will only be responsible for loading the data for one service.

    Then, on your main page, page1.aspx, create iFrames for each of the 4 pages you made.

    If I am correct, the page will load first, and then the 4 pages in the iFrame will load seperately.

    The only other way I can think of doing this is to create 4 different thread for the 4 services on page load. Then get some javascript that pings the threads and loads the data when its ready.

    Wednesday, April 28, 2010 4:04 AM
  • User1648846820 posted

     I was as well thinking of the iFrame idea but was not very confident. However, after seeing another like-minded person, I've decided to try out a POC and check Smile

    I didn't quite understand your second idea: How can a javascript ping a thread on the server? Will be glad if you can point to some resources to achieve same.

    Thanks a lot for your inputs Jagdip.

     

    -Pavan

    Wednesday, April 28, 2010 9:08 AM
  • User1146730029 posted

    This idea is quite complicated, but .....

    1. Create the page as a single page with all the services - just to make sure everything works. Doesnt matter if it takes a long time to load.

    2. Change the code so that the services do not load on page load.

    3. Put each of the outputs from the services in an AJAX panel.

    4. Put a hidden button in each of the AJAX Panels.

    5. Write some javascript that will push the hidden buttons at set intervals.

    6. In the code behind for each of the hidden buttons, actually start a thread and load the services in the thread. Pass back either a 'in progress' message, or the actual results of the services.

    I have seen this being done before, but it was complicated. I am sure there is an easy way. Have a quick search for ASP.NET and Threading, I'm sure you will find some articles in Google.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 28, 2010 11:45 AM