The leaders of the world's two superpowers were all smiles for the cameras during the US president's visit to Beijing.