The web is currently undergoing a change from a document to a service-centered environment. How to integrate the existing service to provide a new value-added service is an ongoing research. Especially dynamic compositions of web services is a particularly difficult problem because of the continued need to provide high availability, reliability, and scalability in the web. We propose a solution that supports dynamic composition of web services based on formal architecture. Software architecture provides a top-down mechanism for component based software reuse. But the graphic service architecture is ambiguous, lacks the precise semantics. This paper gives a formal description of service architecture with Z notation, and then demonstrates an example of dynamic service composition based on the formal architecture. The advantage of this approach is providing precise semantic for the service discovery and composition.