Somalia's Islamist militant group al Shabaab attacked a town in a region near Kenya's border, killing at least seven Somali soldiers, the group and Somali officials said.