Nowadays, a plethora of Web-based environments (Web applications, Web platforms, etc.), publish their functions as RESTful services, i.e., self-contained and self-describing resources that follow the REpresentational State Transfer (REST) architectural style principles. As the Web has become a major medium of communication, integrating objects (e.g., smart devices) into the Web and taking advantage of its open popular standards has created an emerging trend: the Web of Things (WoT). In the WoT, objects expose their functions also as resources respecting the REST principles. Each resource provides well defined functions that meet specific users’ requests. However, there are cases in which a single resource is not sufficient to answer users’ requests, and often, combining two or more resources forming a resource composition, achieves the desired output. Nevertheless, several challenges are to be addressed when composing resources.In this thesis, we address three challenges. The first one consists on verifying the behavior of static resource compositions built manually by the user, as several design errors may occur (e.g., end-loops preventing other resources to run, and datatype mismatch between the Inputs/Outputs of the linked resources). For the other two challenges, the targeted Web environments are hybrid providing: (i) dynamic resources (connected to/removed from the environment at different instances), and (ii) static resources (established to be always available). The challenges focus respectively on the automatic resource discovery, while considering resource location (whenever exposed by objects), and the automatic selection of the appropriate resources to form suitable compositions satisfying users’ requests. To cope with these challenges, we first propose a formal model based on Colored Petri Nets (CPN) that maps resources behavior with their composition to CPN. This allows to use CPN behavioral properties to verify the correctness of static compositions behavior. Then, we propose a formal graph representation linking static resource to dynamic ones, allowing adapted graph algorithms to explore the semantically annotated descriptions of the traversed graph resources, in order to identify automatically the required resources. The resource discovery process uses an original defined indexing schema that allows identifying the resources based on their location (if exposed by objects), and enhancing resource search in large Web environments connecting many resources. As for automatic resource selection, we present a Selection Strategy Adaptor that selects the suitable resources to form several compositions with different implementation alternatives, taking into account Quality of Resource (QoR), Inputs/Outputs matching of related resources, as well as resource availability. Our proposal is generic as it can be applicable in Web environments belonging to different application domains. However, in this thesis, it has been illustrated inthe smart buildings domain, more particularly, in projects for managing buildings’ energy behavior.