Hard and soft X-ray spectroscopy of Sm-based heavy-fermion compounds SmFe4 P12 and SmOs4 Sb12