  A warm corona at the surface of an accretion disc has been proposed as a
potential location for producing the soft excess commonly observed in the X-ray
spectra of active galactic nuclei (AGNs). In order to fit the observed data the
gas must be at temperatures of $\sim 1$ keV and have an optical depth of
$\tau_{\mathrm{T}}\approx 10$--$20$. We present one-dimensional calculations of
the physical conditions and emitted spectra of a $\tau_{\mathrm{T}}=10$ or $20$
gas layer subject to illumination from an X-ray power-law (from above), a
blackbody (from below) and a variable amount of internal heating. The models
show that a warm corona with $kT \sim 1$ keV can develop, producing a strong
Comptonized soft excess, but only if the internal heating flux is within a
relatively narrow range. Similarly, if the gas density of the layer is too
large then efficient cooling will stop a warm corona from forming. The
radiation from the hard X-ray power-law is crucial in producing a warm corona,
indicating that a warm and hot corona may co-exist in AGN accretion discs, and
their combined effect leads to the observed soft excess. Intense heating of a
warm corona leads to steep X-ray spectra with ionised Fe K$\alpha$ lines,
similar to those seen in some narrow-line Seyfert 1 galaxies.
