President Vladimir V. Putin was greeted by President Xi Jinping in Shanghai during his visit to China.