The stereotype is that the US military is overwhelmingly composed of Republicans, and as both a Republican and a veteran, McCain would be far and away their favorite candidate. But the stereotype is wrong.
According to a report by OpenSecrets.org, a transparency group that tracks political donations and their industry origins, Barack Obama is the overwhelming favorite of military personnel who contribute to a presidential candidate. Obama leads McCain $335,536 to $280,513 in contributions from all military personnel. Obama also leads in the total number of contributions, 859 to 558.
Among troops deployed overseas, the difference is even more stark; Obama leads by nearly a 6:1 ratio, $60,642 to $10,665. Also note that antiwar Republican Ron Paul leads McCain in contributions from overseas troops and nearly ties him in overall contributions.