An algebraic theory for web service contracts