## 1 Introduction  
In recent years, the availability of low-cost hardware such as CMOS cameras and microphones that are able to ubiquitously capture multimedia content from the environment has enabled the development of Wireless Multimedia Sensor Networks (WMSNs); networks of wirelessly interconnected devices that allow retrieving video and audio streams, still images, and scalar sensor data [1]. As time has elapsed, WMSNs have become more and more popular and consequently these networks are used in different domains such as multimedia surveillance, health care, traffic avoidance, environmental monitoring, and industrial process control. This wide range of applications has intensified the need for a programming framework that can help programmers overcome the increasing complexities of applications which stem from the distributed nature of applications and also the need for mechanisms to handle harsh operating conditions such as unreliable wireless communications, node failures, and ultra limited available resources. But, the APIs provided by current operating systems available for WSNs are low level and as a result, the development of applications for these networks is a complex, costly, and time consuming task. Due to this dilemma, WMSNs are usually used in an _ad hoc_ manner, and the developed applications for these networks usually consist of static parts which are hard to modify and reuse [2]. These characteristics not only reduce WMSN scalability, but also decrease the modifiability of the networks. For example, if there is a need to modify a program, all nodes of network should be reprogrammed and since physical access to nodes may not be easy due to large number of nodes or impassable environments, reprogramming of nodes must be done remotely. Remote reprogramming is a power consuming task for the reason that radio energy consumption is very high and the compiled program (which is relatively large) must be sent to all nodes. One way to overcome the complexities of application development is using middle-wares, but because of limited resources available in a WSN, it is not possible to use traditional middle-wares in these networks. Therefore, many middle-wares have been proposed for WSNs with the ultimate goal of increasing programming abstraction level and as a result decreasing the development and maintenance cost of WSN programs [2-4]. However, none of them have been specially designed for WMSNs which have some particular characteristics that influence the design of network and as a result the design and implementation of middle-ware. For example, the need for application specific QoS, high bandwidth demand, multimedia source coding techniques, and multimedia in-network processing are some of unique characteristics of WMSNs that the designer of middleware should consider them [1]. Generally, the design and development of a successful middleware for WSN is not trivial. It needs to deal with the many challenges dictated by the characteristics of WSNs on the one hand and the applications on the other hand. Some of challenges in which a middleware designer might face are [5]:  
* Managing limited resources
* Scalability and network topology
* Network heterogeneity
* Quality of service
* SecurityIn this paper, we propose a service oriented middleware named SOMM which specially designed for WMSNs. In the design of the proposed middleware, the mentioned challenges have been considered. The main goal of this middleware is to support multimedia transmission in WMSNs while decreasing the cost of application development and improving network modifiability and scalability. To this end, SOMM taks advantage of virtual machine and code mobility. SOMM structures an application in terms of mobile agents which provide services to each other to accomplish their tasks. SOMM also provides localized tuple spaces as the tools for communication between agents. In addition, some features are provided in SOMM to support QoS requirements of WMSNs.