The high-energy spectral energy distributions of blazars have been modelled many times, but none of the previous studies have started from synchrotron components derived from observations. The common approach has instead been to start with a one-component theoretical synchrotron spectrum, although it is well established both from observations and from theory that the synchrotron emission originates from several components: from a constant jet component and from shocks propagating downstream in the jet. Furthermore, the observed synchrotron flux variability appears to be entirely due to evolving shocks. In this paper we present the first attempt to model the synchrotron, and consequently also the inverse Compton, spectral energy distributions in a more realistic manner. Instead of assuming a single theoretical spectrum as the basis of modelling, we use a code based on the standard shocked jet framework to identify the spectra and the time evolution of both the jet and of the many shock components in 3C 279, one of the best-observed blazars. These semiempirical components, derived from extensive multifrequency monitoring, are then used to estimate the inverse Compton component produced by each component. Previous studies have shown that gamma-ray flaring occurs preferentially after a new mm-radio flare begins, or, equivalently, after a new VLBI shock component has separated from the core. Observed time delays indicate that the shock component is already well outside the broad line region when gamma-ray flaring occurs, casting doubt on the efficiency of external Compton mechanisms. We therefore apply our modelling to the synchrotron self-Compton scenario in order to estimate how large a fraction of the high energy flux during two EGRET observing periods could be explained by SSC radiation. We find that the X-ray flux during both a quiescent and a flaring stage of 3C 279 can be explained by SSC from the jet and from several shocks, but that the gamma-ray fluxes cannot.