Electronic structure of ions and molecules in solution