It is well-known that, if the Slutsky matrix is symmetric and negative semi-definite, an utility function can be obtained by integration of the inverse demand function. Symmetry of the Slutsky matrix is equivalent to mathematical integrability, while negative semi-definiteness (which can be easily deduced from the weak axiom of revealed preference) guarantees that the integral of the inverse demand function is in fact an utility function. However, this result depends strictly on the existence of the inverse demand function, i.e. on the uniqueness of the price-income pair whereby a commodity bundle is demanded. In this work, we remove this uniqueness property and we prove alternatively the existence of an utility function by integration of the "direct" demand function, which is assumed continuous but not necessarily differentiable. More precisely, we suppose that such an integral exists and we show (according to the so-called envelope theorem) that this function is an indirect utility function for the consumer if and only if the weak axiom of revealed preference holds; the direct utility function can be easily deduced from this indirect function in a standard way.