Generally, the composition is the process of combining services to fulfill complex tasks based on their functional and non-functional values such as quality of services (QoS) and context attributes. However, to produce a composition with values that satisfy many requirements is a challenging focus. In this article, the authors proposed a new approach centered evolutionary algorithm called the harmony particle swarm optimization (HPSO) algorithm that leads to an efficient composition with better performance and execution time. The authors' proposed method is a new hybrid version of the harmony search and the particle swarm optimization. The HPSO is designed to generate the best web service composition in a discrete search space. Furthermore, the method includes two filtering processes called Skyline operator and local consistency reinforcement techniques. These methods filter the search space and keep only the most representative candidate services. Results show the effectiveness and the accuracy of the proposed approach.