The formal opening of parliament comes as the British prime minister is fending off threats to his leadership.