The world’s largest retailer is building an e-commerce headquarters in the world’s most populous country. Wal-Mart Stores Inc. announced this week that it had reached an agreement with the government of Shanghai to establish an office in China’s leading commercial city to oversee Wal-Mart’s online retailing operations in China. The retail chain and the Shanghai government agreed to work together to train e-commerce personnel and speed the development of online retailing in China.