How do you prevent the soldiers on rafts from landing on shore and getting the trenches? There's only one cannon that I've seen. I only manage to kill a few of them before it tells me that I failed to defend the trenches.
You need to shoot the rafts coming across the water before they reach the shore. Rafts will sneak in from the far left and right sides.
Aim the cannon above where you want to fire. I good rule-of-thumb is to look at your crosshair. Notice how there are four lines around the circular crosshair? Well for the bottom line, place it just a bit above where you want to shoot, then fire.
You don't need to shoot every raft (if you do, you earn the D-Day achievement). And you can see all the rafts if you look closely enough before they start sailing the lake.