A policeman has been stabbed and his apparent attacker shot dead by officers in a major security incident at the Houses of Parliament.