High-resolution resonant inelastic X-ray scattering (RIXS) at the oxygen K-edge has been used to study the orbital excitations of Ca2RuO4 and Sr2RuO4. In combination with linear dichroism X-ray absorption spectroscopy, the ruthenium 4d-orbital occupation and excitations were probed through their hybridization with the oxygen p-orbitals. These results are described within a minimal model, taking into account crystal field splitting and a spin-orbit coupling lambda_{so}=200~meV. The effects of spin-orbit interaction on the electronic structure and implications for the Mott and superconducting ground states of (Ca,Sr)2RuO4 are discussed.