Harmonics Generation in Experiments with Free-Electron Lasers in the X-Ray Wavelength Range: a Theoretical Analysis