NEW YORK — Facebook to buy mobile messaging service WhatsApp for up to $19 billion in cash and stock.