Software Serial Problem

I'm currently doing a project where I interface a GPS module, digital compass and a ZigBee (XBee modem) to Arduino.

XBee currently uses the hardware UART and it is working fine.

The GPS module and the digital compass are both using Software Serial.

My problem is that if I instantiate both software serials, only the latest one will work.

Below is my sample code:

void CSensor::initSensors()
{
    //for gps
    this->gpsSerial = new SoftwareSerial(2, 3);
    this->gpsSerial->begin(9600);

    //for digital compass
    this->compassSerial = new SoftwareSerial(6, 7);
    this->compassSerial->begin(9600);
}

gpsSerial is declared as a pointer member of CSensor class. -> SoftwareSerial* gpsSerial;
compassSerial is also declared the same -> SoftwareSerial* compassSerial;

In the above sample code, only the digital compass will work, the GPS will not work. But if I interchange the positions of the code such that it will look like this:

void CSensor::initSensors()
{
    //for digital compass
    this->compassSerial = new SoftwareSerial(6, 7);
    this->compassSerial->begin(9600);

    //for gps
    this->gpsSerial = new SoftwareSerial(2, 3);
    this->gpsSerial->begin(9600);
}

The GPS will now work, but the digital compass won't. I assume Software Serial has a problem, what solution can I do?

SoftwareSerial will only monitor one port at a time. My understanding is that it sets up an ISR for the "current" port and the interrupt signals the arrival of a start bit. I think what you have to do is get one full message from the GPS and then get one full message from the compass.