Gary Locke formally resigned today as commerce secretary and was sworn in by Secretary of State Hillary Clinton as the next U.S. ambassador to China.