Abstract. Heterogeneous sensor networks are comprised of ensembles of small, smart, and cheap sensing and computing devices that permeate the environment, as well as resource intensive sensors such as satellite imaging systems, meteorological stations, and security cameras. Emergency response, homeland security, and many other applications have a very real need to interconnect these diverse networks and access information in real-time. Web service technologies provide well-developed mechanisms for exchanging data between heterogeneous computing devices, but they cannot be used in resource-constrained wireless sensor networks. This paper presents OASiS, a lightweight service-oriented architecture for sensor networks, which provides dynamic service discovery and can be used to develop ambient-aware applications that adapt to changes in the network and the environment. An important advantage of OASiS is that it allows seamless integration with Web services. We have developed a middleware implementation that supports OASiS, and a simple tracking application to illustrate the approach. Our results demonstrate the feasibility of a service-oriented architecture for wireless sensor networks.