As sensor and actuator networks (SANETs) evolve, sensor and actuator nodes (SANs) will be frequently added, removed, and upgraded as needed, which we call evolvable SANETs (ESANETs). However, existing service gateways for SANETs are assumed to know the operational environment at design time with limited awareness of operational SANET conditions and, in the meanwhile, provide a single particular form of access without knowledge of application activities. Therefore, current service gateways are infeasible to accommodate ESANETs. To cope with this, this paper presents a reflective service gateway (RSG), which self-adapts to ESANET changes and enables ESANETs to customize its activities according to the application services involved. The key to enabling this is a reflection mechanism whereby RSG is able to monitor network status of multi-hop ESANETs so that its internal structures and behaviors can be altered adaptively. In addition, RSG allows heterogeneous middleware systems (HMSs) to concurrently access ESANETs, promoting the flexibility of RSG to be integrated with HMSs. To evaluate RSG, we compare the ESANET messaging cost of RSG with that of the OSGi-based framework by mathematical models. In addition, we implement a RSG prototype and a set of middleware system case studies. Finally, we conduct empirical performance measurements with home sensor and actuator applications using ZigBee. (C) 2012 Elsevier Inc. All rights reserved.