Abstract. Most of the current wireless sensor networks are built for specific applications, with a tight coupling between them and the underlying communication protocols. We present a more flexible architectural approach for building WSNs, in which application-specific features are decoupled from the underlying communication infrastructure, although affecting the network behavior. We propose a framework based on Web technologies that provides a standard interface for accessing the network and configurable service components tailored to meet different application requirements, while optimizing the network scarce resources. Also, a set of ontologies is defined as part of the framework for representing shared knowledge of the WSN domain.