You're likely thinking of the "Boss Battleship" in Super Mario Galaxy 2, not Super Mario Bros. Wii. Here's how to beat it:
Let me know if you need help with other bosses!