Services in Wireless Sensor Networks:Modelling and Optimisation for the Efficient Discovery of Services