We propose to study with the SWS the interaction of X-rays in the ~ 1 - 100 keV energy range with molecular gas. We use as "X-ray candles" well-defined X-ray sources recently discovered to be associated with molecular clouds: nearby (< 200 pc) low-mass pre- main sequence stars (T Tauri stars), without winds or outflows, and distant (~ 10 kpc) "microquasars". We want to detect 11 selected IR lines of H2 and H3+ in the 4 - 18 mum range. The expected line fluxes are proportional to the X-ray luminosity of the sources. They are typically low for embedded T Tauri stars (~ 10^-17 W.m-2), but detectable using the SWS. For microquasars, provided they are also embedded in molecular clouds, the nominal expected fluxes are ~ 1000 times higher; even if fainter, the lines may be detected with a good SNR in a few hundred seconds. We stress that to date little is known about the interaction of X-rays with molecular gas. Only a few H2 lines have been detected from the ground (e.g., in AGNs and molecular outflows), and H3+ has never been detected outside of the solar system. The H2 lines we select are predicted to be significantly stronger than those detectable on the ground. The general interest of the present proposal is threefold: (i) the H2 IR lines may be produced in a variety of conditions, but X-ray heating is predicted to carry a specific signature (line ratios) which has never been tested; (iii) even in well-defined physical conditions, the theoretical H2 line ratios are still uncertain; (iii) ion-molecule chemistry starts with H3+, and there is a lot of debate about its production rate from H2 with cosmic rays or X-rays, and about its dissociative recombination rate. The proposed observations are expected to put for the first time clear constraints on these issues, and thus may have a strong impact on fundamental questions of interstellar chemistry.