Barack Obama said he was considering going to Iraq this summer, but dismissed an invitation from John McCain to take a joint trip.