The current smart grid is undergoing a drastic change in order to deal with increasingly diversified and various service requests from the huge number of users. The next-generation smart grid, characterized by service-oriented middleware, will be upgraded by jointly employing the technologies in the areas of communications, control, and computing. To design a general middleware, an efficient design principle plays a fundamental role, while reliable communication infrastructure and heterogeneous applications lead to sustainability and stability. In this article, we propose an integrated and efficient middleware for heterogeneous services in a smart grid. Specifically, we first develop a mutual application access control principle that keeps users obtaining a satisfying assignment. Next, a collaborative and dynamic information exchange infrastructure is proposed for different smart meters, and a local information collector is designed to implement the communication and computing through power management messages. Finally, we present four steps to design a flexible service-oriented middleware for heterogeneous applications. Numerical simulation results are provided to demonstrate the efficiency of the proposed middleware.