The missile was launched just a day after Iran threatened to strike Tel Aviv and United States interests if attacked. Iran's Revolutionary Guards reported on Wednesday it fired nine test missiles, including one which the government in Tehran says has the range to reach Israel.
State-run Arabic channel Al-Alam said the long-range Shahab-3 was fired off simultaneously at 8:00 am (0330 GMT) from an undisclosed location in the Iranian desert.
McCain said Iran's most recent missile tests demonstrated the dangers it poses against its neighbors and to the wider region, especially against Israel.
"Ballistic missile testing coupled with Iran's continued refusal to cease its nuclear activities should unite the international community in efforts to counter Iran's dangerous ambitions," McCain said in a statement.
"Iran's missile tests also demonstrate the need for effective missile defense now and in the future, and this includes missile defense in Europe as is planned with the Czech Republic and Poland," he added.
In an interview with ABC's "Good Morning America", presumptive Democratic nominee Obama said Iran's reported missile tests justify the need to conduct direct diplomacy.
"Iran must suffer threats of economic sanctions with direct diplomacy opening up channels of communication so we avoid provocation, but we give strong incentives for the Iranians to change their behavior," Obama said.
"We have to have a kind of aggressive diplomacy which unfortunately has been absent over the last several years."
The United States has also claimed a "tentative agreement" with Poland on the deployment of a missile defense shield there. But Poland said an agreement has not been finalized yet.