In response, a Chinese Foreign Ministry spokesman, Lu Kang, suggested Wednesday that it was the United States that had lost the most from the North Korean announcement. “As for whose face the D.P.R.K. slapped, the country itself knows well,” Mr. Lu said, using the initials for North Korea’s formal name, the Democratic People’s Republic of Korea.

But on Friday, President Obama spoke by telephone with President Xi Jinping about the planned missile test, and in a summary of the call, the White House said that both leaders “reaffirmed their commitment to the complete and verifiable denuclearization of the Korean Peninsula.”

They agreed that a test would violate United Nations Security Council resolutions, and that a “strong and united international response to North Korea’s provocations” was important.

The North’s announcement was an embarrassing setback for China, coming just hours after one of its senior diplomats, Wu Dawei, had arrived in Pyongyang. Both China and the United States had known, based on satellite imagery, that the North was planning another launch, and one of Mr. Wu’s main goals for the trip had been to persuade the North Koreans not to proceed, diplomats said. The dates the North gave for the launch suggested it was likely to occur as China celebrates its weeklong Lunar New Year holiday, starting Sunday.

On his return to Beijing on Thursday, Mr. Wu conceded that China had little leverage over its recalcitrant ally. “I said everything that must be said. I did what must be done,” he told reporters. “But what the outcome will be, I don’t know yet.”

Mr. Wu had an unpleasant task, said Cheng Xiaohe, an associate professor of international studies at Renmin University. “That the North Koreans carry on regardless and announce their launch plans makes it more embarrassing for China, which has been arguing against more crippling sanctions and urging countries to solve the problem peacefully,” he said.

The Chinese hope to prevent tougher sanctions for fear that the North will become a hostile neighbor, a policy that diplomats said appears to have been shaped by President Xi Jinping last summer. In talks last week with his Chinese counterpart, Foreign Minister Wang Yi, Secretary of State John Kerry made little headway in persuading China to toughen sanctions against North Korea, and he warned that the United States would most likely move ahead on its own.