Gunmen have killed at least 17 Indian soldiers in an attack on a military base in Indian-administered Kashmir near the disputed border.