Relative elliptic theory and the Sobolev problem