Diffraction of X-ray beams in capillary waveguides