To protect yourself from the shulker's projectiles, you need to press on it with your sword.