A theory of contracts for web services