Enabling the ambient intelligence vision means that consumers will be provided with universal and immediate access to available content and services, together with ways of effectively exploiting them. Concentrating on the software system development aspect, this means that the actual implementation of any ambient intelligence application requested by a user can only be resolved at runtime according to the user's specific situation. This paper introduces a base declarative language and associated core middleware, which supports the abstract specification of Ambient Intelligence applications together with their dynamic composition according to the environment. The proposed solution builds on the Web services architecture, whose pervasiveness enables both services availability in most environments, and specification of applications supporting automated retrieval and composition. In addition, dynamic composition of applications is dealt in a way that enforces the quality of service of...