In the following paper, we study the tradeoff between network lifetime and network utility for energy-constrained wireless sensor networks (WSNs) with the real-time requirement. By introducing a parameter r, we combine these two objectives into a single weighted objective, and consider rate control and routing in this tradeoff framework simultaneously. For real-time requirement, we set up real-time constraints by forcing the end-to-end delay of each route to be bounded by the maximum tolerated delay and incorporate real-time constraints into the tradeoff framework. Consequently, the tradeoff model is formulated nonlinear programming. By using the dual decomposition method and gradient/subgradient algorithms, we propose a distributed algorithm to solve nonlinear programming. Rigorous analysis and simulation are presented in order to validate our algorithm.