In this application, the XBee modules should be nothing more than a 3V CMOS cable replacement between the devices. What I would suggest is start by taking the radios out of the picture and simply wire it as a direct COM port. Then adjust your code accordingly.
Once you have done that, you can then put the radios in between using transparent mode and no changes to your code.