The US president will travel to Japan before he attends the annual Asia-Pacific Economic Cooperation summit in South Korea.