In service oriented systems, complex applications can be composed as business processes invoking a variety of available web services with different characteristics. Usually, a set of functionally equivalent services can be selected, that is, services which implement the same functionality but differ for quality parameters. Under this scenario, applications are defined as high level business processes and service composition can be implemented dynamically by identifying the best set of services available at run time satisfying also Quality of Service (QoS) constraints. In this paper, we model the service composition problem as a mixed integer linear problem where local constraints, that is, constraints for component web services, and global constraints, that is, constraints for the whole application, can be specified. Our approach proposes the formulation of the optimisation problem as a global ptimisation. Constraints are fulfilled statically at deployment time and are guaranteed at run time through dynamic reoptimisation. Experimental results demonstrate the effectiveness of our approach.