the dia- grams. In order to provide a precise understanding of the meaning of the PESM and composition policies, we have defined a formal semantics for global policy rules and for global PESM diagrams. See Rossebo and Runde [14] for details. 5.5 Design Models At the design model layer, we describe the behavior as distributed to the compo- nents of the system. The behavior of each elementary role is given as a UML 2.x state machine. Their coordination into composite roles is described using local How to Model Dynamic Service Composition Using UML 2.x composition policies and local PESM diagrams, one for each composite role. In Rossebo and Runde [4], we have defined a formal semantics for local policy rules and for local PESM diagrams. For details, see Rossebo and Runde [14]. In this chapter, we explain how the local composition policies and PESM diagrams may be automatically derived from the global ones. 5.5.1 Local Composition Policies Each global policy rule at the service model layer corresponds to two or more local rules, one for each of the composite roles involved in the collaboration specified in the action part. The role receiving the trigger is referred to as the initiating role, while the other one or more roles are called participating roles. In addition to performing its role in the collaboration, the initiating role is responsible for sending a role request demanding the participating role to play its part, for each participating role. Note that the initiating party is not necessarily the first one to act within the collaboration. This is to allow for providing a choice between collaborations to execute regardless of the behavior specified within the collaboration. Separating the initiating role from the collaboration to be initiated thus allows for greater flexibil- ity in dynamic composition. The local policy rules are similar to the global rules in that they consist of a trig- ger, a condition, an action, and a goal. The main difference is that the actions to be performed are now given as state mac