A reliable `in situ' method for wavefront sensing in the soft X-ray domain is reported, developed for the characterization of rotationally symmetric optical elements, like an ellipsoidal mirror shell. In a laboratory setup, the mirror sample is irradiated by an electron-excited (4.4 keV), micrometre-sized (∼2 µm) fluorescence source (carbon K α, 277 eV). Substantially, the three-dimensional intensity distribution I(r) is recorded by a CCD camera (2048 × 512 pixels of 13.5 µm) at two positions along the optical axis, symmetrically displaced by ±21–25% from the focus. The transport-of-intensity equation is interpreted in a geometrical sense from plane to plane and implemented as a ray tracing code, to retrieve the phase Φ(r) from the radial intensity gradient on a sub-pixel scale. For reasons of statistical reliability, five intra-/extra-focal CCD image pairs are evaluated and averaged to an annular two-dimensional map of the wavefront error {\cal W}. In units of the test wavelength (C K α), an r.m.s. value \sigma_{\cal{W}} = ±10.9λ0 and a peak-to-valley amplitude of ±31.3λ0 are obtained. By means of the wavefront, the focus is first reconstructed with a result for its diameter of 38.4 µm, close to the direct experimental observation of 39.4 µm (FWHM). Secondly, figure and slope errors of the ellipsoid are characterized with an average of ±1.14 µm and ±8.8 arcsec (r.m.s.), respectively, the latter in reasonable agreement with the measured focal intensity distribution. The findings enable, amongst others, the precise alignment of axisymmetric X-ray mirrors or the design of a wavefront corrector for high-resolution X-ray science.