Pervasive computing, the new distributed computing paradigm aiming at providing services anywhere anytime, poses unique challenges on service management and discovery. In this paper, we propose a new pervasive computing framework named USDM-PerComp by using a Web Service Server/Directory Server (WSS/DS) based two-level hierarchical topology to address the challenges involved. DSs within USDM-PerComp autonomously form a peer-to-peer (P2P) overlay. We present a Gnutella inspired distributed algorithm to support service discovery over the resulted P2P overlay, and further implement a service crawler using mobile agent techniques to perform the discovery and invocation. With the service crawler, service composition could be done automatically and spontaneously without any user concern. Besides, we develop a distributed JPEG encoding application to verify the practicability of our proposal. Our experience confirms the scalability and flexibility of USDM-PerComp. The pervasive applications could be easily us well as efficiently created under USDM-PerComp environment.