With the development and application of Web service technology, the security of Web service is becoming more and more important. The security of SOAP message is an important factor which decides Web service security. In order to realize the security of SOAP message, an approach to partly sign and encrypt on SOAP message based on Rampart is proposed in this paper. The experimental results demonstrate that the approach can enhance the security of Web service, as well as improve the flexibility for Web service message transmission and operation.