Valence and core excitations of adsorbates on metal surfaces