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 6899505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:25:48+00:00 2026-05-27T07:25:48+00:00

I am making a booking comparison engine, and I have a very sensitive problem.

  • 0

I am making a booking comparison engine, and I have a very sensitive problem.

The deal is that I have 3-4 different sources to compare results. And each data provider has it’s own API, and in each search method you have another pagination, so you can send them request:

  • pageSize
  • pageNumber
  • search params

and you get basically back:

  • search Results
  • resultQuantity
  • the number of objects returned with that given search params

So I populate them via JQuery. Actually an Ajax GET request is sent to my

http://www.mysite.com/search_script.php

And the results are populated.

Lets say we have:

  1. Source1.com/api.php
  2. Source2.com/api.php

and on our website we need to arrange a good pagination. Saying good I mean made professionally, so that we don’t load too much the browser, and the server also with too much API queries.

I have thought that I could make it in this way:

If in my site I have pagination of 10 results per page, then I would query both sources with requests to send back 5 results per page.

But I would then face 2 types of problems:

  • 1st page returns 5 of 23 2nd only 4
    5+4,5+0,5+0……

  • Both have more than 5, but one ends before than second one let’s say 12 and 5
    5-5,5-0,5/0

  • …

Not a good solution…

What is a workout for such situation????

1st is soap call

    SOAP 1.2

The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.

POST /partnerV3/Webservice.asmx HTTP/1.1
Host: webservices.interhome.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Header>
    <ServiceAuthHeader xmlns="http://www.interhome.com/webservice">
      <Username>string</Username>
      <Password>string</Password>
    </ServiceAuthHeader>
  </soap12:Header>
  <soap12:Body>
    <Search xmlns="http://www.interhome.com/webservice">
      <inputValue>
        <Page>int</Page>
        <PageSize>int</PageSize>
        <OrderDirection>NotSet or Ascending or Descending</OrderDirection>
        <OrderBy>NotSet or Favorite or Price or Place</OrderBy>
        <LanguageCode>string</LanguageCode>
        <CurrencyCode>string</CurrencyCode>
        <SalesOfficeCode>string</SalesOfficeCode>
        <Quicksearch>string</Quicksearch>
        <CountryCode>string</CountryCode>
        <RegionCode>string</RegionCode>
        <PlaceCode>string</PlaceCode>
        <CheckIn>string</CheckIn>
        <Duration>int</Duration>
        <ThemeFilter>NotSet or Cheepcheep or Countryside or Familyfriendly or HolidayVillage or LakesAndMountains or Nightlife or Selection or SomewhereQuiet or SummerHoliday or Cities or SuitableForSeniors</ThemeFilter>
        <HouseApartmentType>NotSet or Apartment or DetachedHouse or House</HouseApartmentType>
        <Facilities>
          <Facilities>NotSet or Aircondition or Balcony or BBQ or Cot or Dishwasher or Fireplace or Internet or InternetWiFi or Jacuzzi or LuxuriousFurnishings or ModernFurnishings or NiceKitchen or NiceSourroundings or Parking or LiftsInhouse or NonSmoker or Pets1 or Pets2 or Pets3 or PetsNo or PoolAll or PoolChildren or PoolIndoor or PoolPrivate or Sauna or Swimmingpool or TV or WashingMachine or Wheelchair</Facilities>
          <Facilities>NotSet or Aircondition or Balcony or BBQ or Cot or Dishwasher or Fireplace or Internet or InternetWiFi or Jacuzzi or LuxuriousFurnishings or ModernFurnishings or NiceKitchen or NiceSourroundings or Parking or LiftsInhouse or NonSmoker or Pets1 or Pets2 or Pets3 or PetsNo or PoolAll or PoolChildren or PoolIndoor or PoolPrivate or Sauna or Swimmingpool or TV or WashingMachine or Wheelchair</Facilities>
        </Facilities>
        <Accessibilities>
          <Accessibilities>NotSet or FamilyFrienldy or LiftsInhouse or NonSmoking or PetsWelcome or PetsNotAllowed or SuitableForSeniors or WheelchairAccessible</Accessibilities>
          <Accessibilities>NotSet or FamilyFrienldy or LiftsInhouse or NonSmoking or PetsWelcome or PetsNotAllowed or SuitableForSeniors or WheelchairAccessible</Accessibilities>
        </Accessibilities>
        <Activities>
          <Activities>NotSet or Biking or CrossCountrySkiing or Golfing or Hiking or MountainBiking or Nightlife or NordicWalking or Riding or Sailing or Skiing or Snowboarding or Surfing or Tennis or ThemeParkNearby or Toboggan or Windsurfing or SkiingSnowboarding</Activities>
          <Activities>NotSet or Biking or CrossCountrySkiing or Golfing or Hiking or MountainBiking or Nightlife or NordicWalking or Riding or Sailing or Skiing or Snowboarding or Surfing or Tennis or ThemeParkNearby or Toboggan or Windsurfing or SkiingSnowboarding</Activities>
        </Activities>
        <Situations>
          <Situations>NotSet or ByTheSea or InAHistoricTown or InAMajorCity or InTheCountryside or InALakesideTown or SomewhereQuiet or OnAIsland or Center100 or Center500 or Center1000 or Golf200 or Golf500 or Golf5000 or Lake50 or Lake1000 or Lake10000 or Sea50 or Sea1000 or Sea10000 or Skilift50 or Skilift500 or Skilift10000 or CountryView or LakeView or MountainView or SeaView</Situations>
          <Situations>NotSet or ByTheSea or InAHistoricTown or InAMajorCity or InTheCountryside or InALakesideTown or SomewhereQuiet or OnAIsland or Center100 or Center500 or Center1000 or Golf200 or Golf500 or Golf5000 or Lake50 or Lake1000 or Lake10000 or Sea50 or Sea1000 or Sea10000 or Skilift50 or Skilift500 or Skilift10000 or CountryView or LakeView or MountainView or SeaView</Situations>
        </Situations>
        <PropertyTypes>
          <PropertyTypes>NotSet or Apartment or Bungalow or CastleManor or Chalet or DetachedHouse or Farmhouse or HistoricProperty or HolidayVillage or SpecialProperty or Villa</PropertyTypes>
          <PropertyTypes>NotSet or Apartment or Bungalow or CastleManor or Chalet or DetachedHouse or Farmhouse or HistoricProperty or HolidayVillage or SpecialProperty or Villa</PropertyTypes>
        </PropertyTypes>
        <SpecialOffer>NotSet or AnySpecialOffer or EarlyBooker or LastMinute</SpecialOffer>
        <PaxMin>int</PaxMin>
        <PaxMax>int</PaxMax>
        <RoomsMin>int</RoomsMin>
        <RoomsMax>int</RoomsMax>
        <BedroomsMin>int</BedroomsMin>
        <BedroomsMax>int</BedroomsMax>
        <BathroomsMin>int</BathroomsMin>
        <BathroomsMax>int</BathroomsMax>
        <QualityMin>int</QualityMin>
        <QualityMax>int</QualityMax>
        <DistanceToCenter>int</DistanceToCenter>
        <DistanceToGolfCourse>int</DistanceToGolfCourse>
        <DistanceToLake>int</DistanceToLake>
        <DistanceToSea>int</DistanceToSea>
        <DistanceToSeaOrLake>int</DistanceToSeaOrLake>
        <DistanceToSkiLifts>int</DistanceToSkiLifts>
      </inputValue>
    </Search>
  </soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <SearchResponse xmlns="http://www.interhome.com/webservice">
      <SearchResult>
        <ResultCount>int</ResultCount>
        <Items>
          <SearchResultItem>
            <AccommodationCode>string</AccommodationCode>
            <Country>string</Country>
            <CountryCode>string</CountryCode>
            <Region>string</Region>
            <RegionCode>string</RegionCode>
            <Place>string</Place>
            <PlaceCode>string</PlaceCode>
            <Zip>string</Zip>
            <CurrencyCode>string</CurrencyCode>
            <Price>decimal</Price>
            <Quality>int</Quality>
            <Type>string</Type>
            <Pax>int</Pax>
            <Rooms>int</Rooms>
            <BedRooms>int</BedRooms>
            <Pets>int</Pets>
            <Cots>int</Cots>
            <AdditionBeds>int</AdditionBeds>
            <Parking>boolean</Parking>
            <TV>boolean</TV>
            <Dishwasher>boolean</Dishwasher>
            <Washingmachine>boolean</Washingmachine>
            <Aircondition>boolean</Aircondition>
            <Pool>boolean</Pool>
            <Tennis>boolean</Tennis>
            <Sauna>boolean</Sauna>
            <Wheelchair>boolean</Wheelchair>
            <GeoLng>decimal</GeoLng>
            <GeoLat>decimal</GeoLat>
            <InsideDescription>string</InsideDescription>
            <Picture>string</Picture>
          </SearchResultItem>
          <SearchResultItem>
            <AccommodationCode>string</AccommodationCode>
            <Country>string</Country>
            <CountryCode>string</CountryCode>
            <Region>string</Region>
            <RegionCode>string</RegionCode>
            <Place>string</Place>
            <PlaceCode>string</PlaceCode>
            <Zip>string</Zip>
            <CurrencyCode>string</CurrencyCode>
            <Price>decimal</Price>
            <Quality>int</Quality>
            <Type>string</Type>
            <Pax>int</Pax>
            <Rooms>int</Rooms>
            <BedRooms>int</BedRooms>
            <Pets>int</Pets>
            <Cots>int</Cots>
            <AdditionBeds>int</AdditionBeds>
            <Parking>boolean</Parking>
            <TV>boolean</TV>
            <Dishwasher>boolean</Dishwasher>
            <Washingmachine>boolean</Washingmachine>
            <Aircondition>boolean</Aircondition>
            <Pool>boolean</Pool>
            <Tennis>boolean</Tennis>
            <Sauna>boolean</Sauna>
            <Wheelchair>boolean</Wheelchair>
            <GeoLng>decimal</GeoLng>
            <GeoLat>decimal</GeoLat>
            <InsideDescription>string</InsideDescription>
            <Picture>string</Picture>
          </SearchResultItem>
        </Items>
      </SearchResult>
    </SearchResponse>
  </soap12:Body>
</soap12:Envelope>

and the second is the same ….

  • 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-27T07:25:49+00:00Added an answer on May 27, 2026 at 7:25 am

    You need create objects for each connection.

    This objects will load the content loaded to an array. They can be represented by:

    function Connection( searchQuery, callback )
    {
        var result = []; // use to save what you load
        this.total; // total searching found
    
        this.getResult = function( start, length, callback ){}; // it's is one of the possibilities.
        // this function should verify if the content is already loaded in result[] or not. If not, load then. There is no problem of loading more then needed.
    }
    

    When you conclude, it should work in the way similar to that:

    var conn = new Connection( "...", objectIsWorkable ); // load the first XX results and get the total found stuff.
    conn.getResult( 0, 5, whenLoaded );
    

    After this working, then you can do what you really want:

    var pageController = function( queries, callback )
    {
        var ITEM_PER_CONNECTION = 5;
        var ITEM_PER_PAGE = 10;
        var conns = []; // used to save all connections
        var pages = []; // use to save the pages to be loaded
        var loaded = 0;
    
        var onLoadedCallback = callback;
    
        var totalConnPage;
        var onPageLoadedCallback;
        var tempPage; // the items loaded are saved here.
        var appendToTempPage = function( value )
        {
            for( var i in value ) tempPage.push( value[i] );
            loaded++;
            if( loaded == totalConnPage ) onPageLoadedCallback( tempPage );
        }
    
        this.loadPage = function( num, callback )
        {
            onPageLoadedCallback = callback;
    
            loaded = 0;
            tempPage = [];
            totalConnPage = 0;
            var current = pages[num];
            for( var i = 0; i < current.length; i++ )
            {
                if( current[i] != null )
                {
                    conns[i].getResult( current[i][0], current[i][1], appendToTempPage );
                    totalConnPage++;
                }
            }
        }
    
        var makePages = function()
        {
            // get the total
            var total = 0;
            var totals = [];
            for( var i in conns )
            {
                total += conns[i].total;
                totals.push( 0 );
            }
    
            // create the page list
            while( total > 0 )
            {
                var temp = total > ITEMS_PER_PAGE ? ITEMS_PER_PAGE : total;
                total -= temp;
                var page = [];
                var index = 0;
                while( temp > 0 )
                {
                    if( totals[index] < conns[index].total )
                    {
                        if( conns[index].total - totals[index] >= ITEM_PER_CONNECTION )
                        {
                            var next = temp > ITEM_PER_CONNECTION ? ITEM_PER_CONNECTION : temp;
                            page.push( [totals[index], next] );
                            totals[index] += next;
                            temp -= next;
                        }
                        else
                        {
                            var next = conns[index].total - totals[index];
                            next = next > temp ? temp : next;
                            page.push( [totals[index], next] );
                            totals[index] += next;
                            temp -= next;
                        }
                    }
                    else
                        page.push( null );
    
    
                    index++;
                }
    
                pages.push( page );
            }
        }
    
        var inited = function()
        {
            pages[loaded] = 0;
            loaded++;
    
            if( loaded == conns.length )
            {
                makePages();
                onLoadedCallback();
            }
        }
    
        // init
        for( var i in queries )
            conns.push( new Connection( queries[i], inited ) );
    }
    

    The most import thing is the makePages, probably is what you are wonderring to do. But your question is a little long then I put a little more stuff to not be confusing.

    You can change makePage to work in your way. The idea is saving all pages contents in pages var.

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

Sidebar

Related Questions

I am making a booking app now and have a problem. I need a
I am making a booking system where users can make appointments with each other.
An email confirmation gets sent when my website users making a booking. I have
I am making a project that sells product and I want to have a
I am making a form that submits some values to a site for booking
Making a ship game because I am incredibly original.. With that aside, I have
Making my first steps with NHibernate, I'm trying to have it creating my Tables
Making an adobe flex ui in which data that is calculated must use proprietary
Making my first steps in RIA Services (VS2010Beta2) and i encountered this problem: created
Making UML sequence diagram in VS 2010RC I've observed that there is no activation

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.