We analyze optical soliton propagation in the presence of weak absorption lines with much narrower linewidths as compared to the soliton spectrum width using the novel perturbation analysis technique based on an integral representation in the spectral domain. The stable soliton acquires spectral modulation that follows the associated index of refraction of the absorber. The model can be applied to ordinary soliton propagation and to an absorber inside a passively modelocked laser. In the latter case, a comparison with water vapor absorption in a femtosecond Cr:ZnSe laser yields a very good agreement with experiment. Compared to the conventional absorption measurement in a cell of the same length, the signal is increased by an order of magnitude. The obtained analytical expressions allow further improving of the sensitivity and spectroscopic accuracy making the soliton absorption spectroscopy a promising novel measurement technique.