RFID middleware is a cornerstone of non-trivial RFID deployments in complex heterogeneous environments. In this paper we present the principal middleware building blocks specified in the scope of the EPCglobal architecture. Alternative protocols and implementation frameworks for realizing these middleware blocks are also presented. At the same time we outline several middleware extensions to the EPCglobal architecture, towards meeting common requirements of automatic identification applications. Furthermore, we classify RFID applications into various categories based on their complexity, as well as based on their closed or open loop nature. Accordingly, we highlight the middleware blocks that are most important to each application category.