A Colored Petri Nets Based Model and Verification for Services Composition

Service composition process generates composite services in order to fullfill service consumer’s requirements that cannot be satisfied by a single service. Literature review addressed services composition but ignored verifying the existence of several serious issues, which may affect Service composition and may lead to failure of the given composite services in the execution time, including consistency of the functionality and QoS Criteria. This paper adopts Colored Petri Nets based model for Services Composition and proposes a QoS aware algorithm for verifying the consistency of composite services. A case study is provided for demonstrating the applicability of the proposed model and algorithm using concepts and values of QoS Criteria of composite services.


Introduction
Services Composition attracts more and more attention as it plays important role in service oriented business especially in cloud services. There is a need to compose services together in order to fulfill requirements that cannot be satisfied by a single service. Verification of generated composite Services can assist on avoid serious issues may occur in execution time. These issues include Deadlock, Liveness, Reachability, etc., which may be ignored in design time. Many research and studies addressed services composition, and here is an overview of various verification approaches and tools adopted for verifying services composition.
Wibowo et al [1] proposed a fuzzy multi-criteria group decision making method for evaluating the performance of Cloud services in an uncertain environment. In the proposed method, intuitionistic fuzzy numbers are used to better model the subjectivity and imprecision in the performance evaluation process.
Deng et al [2] proposed a reliability calculation method for Web service compositions, which uses Fuzzy Reasoning Colored Petri Net (FRCPN) to verify the Web service compositions. The method presented a definition of semantic threshold similarity for Web services and a formal definition of FRCPN. In addition, the method analyzed five kinds of production rules in FRCPN, and applied the method to an SCP prototype.
Hou Jinkui and Wang Lei [3] presented formal model for web service composition and verification. The model was defined based on a framework of category theory. Process Algebra was introduced into the framework to describe the external behavior of service component, establishing a formal semantic model for the architecture of Web service system. In [4], authors proposed an automated approach for verifying the functional requirements of a service consumer using semantics of services composition. In addition, a model checker was developed to facilitate the process of verification. The approach took advantage of labeled transition systems (LTSs) by using the semantics of BPEL programs for functional verification. Zahoor E, Perin O and Godart C [5] introduced an approach to verify the services composition processes using a method called satisfaction-solving method. The satisfaction-solving approach uses the nature of declarative processes that are defined by specifying the constraints that determine the boundary of the solution of the composition process.
SPIN [6] is a tool used for verification of distributed systems. The inputs to SPIN is a program written using Promela, a meta-language for processes and their properties are specified using linear temporal logic. The tool examines whether the program can satisfy the stated requirements.
The authors in [7] introduced a services composition model and its verification algorithm based on interface automata. The model provides semantic description of services by the extension of the interface automat. In addition, transformation rules between BPEL description and the semantic service interface automata model is defined.
Process Algebra [8] is a set complex mathematical based languages with well-defined semantics that facilitate describing and verifying the properties of concurrent communicating systems. They are modeled by means for describing labeled transition applications. LTSA (Labeled Transition System Analyzer) is a popular tool used for Finite State Process FSP model that traverses the state-space defined by a model and generates reports about first safety or progress errors that may encounter. FSP [9] used in LTSA and efficiently adopted only for the design time validation.
In [10], authors proposed a CPN based model and verification for services composition. This model illustrates types of control construct and introduces software agents works together with OWL-S specification. However, they did not mention QoS consistency, which plays an important role in composition verification.
Literature review shows there is a need to check the consistency of QoS creteria of the generated composite services in order to avoid problems that may arise in execution time and affects related users and applications.
The main contribution of this paper is presenting a Colored Petri Nets based model for services composition. The component services and their composition construction types in composite services are transferred from OWL-S into Colored Petri Nets (CPN) model using a tool called CPN Tools. In addition, an algorithm is defined to verify the QoS Criteria consistency of services composition.
The rest of the paper is organized as follows: section 2 presents a Literature Review related to the study. Section 3 introduces the proposed model and algorithm in detail. Section 4 presents a case study of implementation of the proposed model. In section 5, we summarize the content and the findings of this study.

Verification of Services Composition
Verification of Services Composition plays a vital role in order to avoid serious issues may occur in execution time including Deadlock, Liveness, Reachability, etc. The following is a list of some works of verification involved PI Calculus, Petri Nets and Automatic Machine.
(1) PI Calculus: Yuan Zhang et al. [11] studied the issue of behavioral modeling in a service composition. In their work, they adopted timed PI calculus to model service behaviors and interactions in a formal way. To deal with the structural composition, they extended the syntax and semantic of PI Calculus. In [12], an Extended Process Calculus for Cloud Services Composition is presented. The syntax and operational semantics were investigated.
(3) Automatic Machine: Jamal Bentahar et al. [15] defined a model for checking Services Composition based on operational behaviors. The model is checked against properties defined in the control behavior. The work examines properties such as soundness and completeness of the design model according to the operational and control behaviors. An automatic testing tool called WSOTF [16] is developed for Services Composition Verification. The testing tool includes an online testing algorithm, which integrates ideas of test execution, and test debug is used to produce and execute the test cases.

Petri Nets and Colored Petri Nets
A Petri Net [17] is a bipartite directed graph, which contains two kinds of nodes called places and transitions. In addition, there is a set of arcs, which links the places with transitions or transitions with places, and there are tokens that located in places in order to show the current state of the net. A composite service is presented by an ordered set of the component services that are mapped into a Petri Net. The mapping process is performed by determining services' operations with transitions along with the state of service operations and places. The places, transitions and related components in petri nets are defined as the following mathematical model.
Definition 1: A Petri Net can be defined as the tuple: PN= (P, T, A), where: (1) P is a non-empty set of places. (2) T is a non-empty set of transitions. (3) A is a set of directed arcs which connect the places and transitions, and . As Petri Nets model has powerful features, including asynchronous, concurrent, process interoperability, etc., therefore, Petri Nets model has been widely adopted in software engineering, industrial control and many other fields. However, Petri Net model has a limitation in data concept; all data should be transferred into places and transition, and then system model becomes huge. Then Jensen [17] added a Color concept and extended the traditional Petri Nets into Colored Petri Nets.

Modeling Services Composition in Colored Petri Nets
In this section, a CPNs model based on OWL-S [18] definition is adopted to model the component services included in a composite service. Firstly, we introduce an Algebraic Model for composite services. Secondly, the structural description of services composition in Colored Petri Nets model is presented. Finally, the Composition Constructions on Colored Petri Nets model are introduced.

1) Algebraic Model for Composite Services
The process of composing two or more services together is to generate a new value-added service, i.e., composite service, and this is performed according to a specific algebraic model between the component services. The typical operators, including as Sequence, Choice, Parallel, and Iteration are the basis for describing the control flow among component services in a composite service. Formally, the Algebraic Model for a composite service is represented as the following: (1) Si (where 1 i n) represents an atomic service.
(2) ∆ denotes a Sequence operator. A Sequence operator of two services S1 and S2 indicates producing a composite service by the sequential execution of the two services.
(3) Φ indicates a Choice operator. A Choice operator indicates that according to the choice of a certain condition, a composite service can be constructed by choosing a service S3 or service S4 for execution.
(4) Ψ denotes a Parallel operator. A Parallel operator indicates producing composite service by parallel execution of more than one service. (5) indicates an Iterative operator. An Iterative operator represents producing composite service by repeating the execution of a service Si until reaching a certain condition.

2) Structural Description of Service Composition in Colored Petri Nets Model
As mentioned above, Colored Petri Net are the extended form of traditional Petri Nets. Colored Petri Nets model adds colors and types concepts in order to describe complex data. In addition, Colored Petri Nets model integrates the advantages of traditional Petri Nets model and the advantages of advanced programming languages in order to describe, build, and analyze distributed systems. Therefore, this model becomes suitable for modeling service composition and applications in collaboration environments.
In this study, we use the formalization of Colored Petri Nets to describe composite services, and its corresponding support tool: CPN Tools is used for illustrating the composite services graphically.
Definition 2: A Services Net [17] in CPN model is represented as tuple SN= {PN, In, Out}, where: (1) CPN indicates a colored petri net.
(3) Out denotes output places set. Definition 3: a composite service is represented by the tuple CS u = { S set , , SN}, where: (1) S set is the set of services that forms a composite service CS u . If Sset has only one member: S set ={s}, then CS u is an atomic service, otherwise CS u is a composite service.
(2) denotes the composition construction types, and its values are obtained from ControlConstrust set {Sequence，AND-Split，If-Then-Else, Iterate, Repeat-While, Repeat-Until}, where Sequence is used in sequence composition construction, AND-Split is used in Parallel composition construction, If-Then-Else is used in Choice composition construction, and Iterate, Repeat-While, Repeat-Until are used in Iterated composition construction.
(3) SN is the model of a composite service in Colored Petri Nets model. In OWL-S, an atomic service usually corresponds to a process. In services composition, an atomic service and composite service are modeled as a composite process. Figure 1 illustrates an atomic process in a Petri Net model. It has only one transition called Process1. To make it simpler, we suppose it has only an input In and an output Out.
In a Colored Petri Nets model, each place has a color set which specifies the values of the tokens. In Figure 1, the places In, Out are included in a set of places P whereas their colored sets NAME and TEL, respectively are included in the set of colored sets ColSet. Transaction Process1 presents the service which has an input and an output (In, Out). 3

) Composition Constructions in Colored Petri Net Model
A composite service is modeled as a set of atomic processes with composition constructions that connect these processes. Based on the analysis of the typical operators and the set ConstructControl of the control flow mentioned above, there are four types of Composition Constructions. In the following, several Composition Constructions of services composition, which illustrate mapping and transformation composite services from OWL-S into Colored Petri Nets, are introduced and explained using CPN tools. (1) Sequential Construction: It defines a set of processes that execute in sequence. Process1 and Process2 (white squared shapes) are executed in a sequential order, whereas black ones indicate control transitions, which used to execute combinational operations as shown in Figure 2-a.
(2) Choice Construction: It indicates choosing a process from given processes to be carry out. In Figure 2 Process1 and Process2 can be selected, once one of them is selected, the other must be abandoned as in Figure 2  (4) Iteration Construction: In iterated construction, OUT1 is checked, if the condition FLAG is satisfied, a transition process1 is executed until the condition FLAG is not satisfied (NOT FLAG) and then the current loop is terminated, and the next process is executed as in Figure 3

Verifying of Services Composition in Colored Petri Nets
In this section, we describe Verifying QoS Criteria of services composition. The QoS Criteria of composite services are verified by finding the optimal composite service, which is compared with the optimal composite service that is found in advance. Algorithm 1 illustrates the Verifying process of QoS Criteria of services composition. Algorithm 1: Verifying QoS Criteria Input: CS set is a set of composite services; CS optimal is a composite service in CS set that is known as the optimal composite service in advance; W is a set of QoS weights; Const global is a set of global QoS constraints. Output: True or false, finding the optimal composite service in CS set and determine if it is the same composite service CS optimal as supposed to be. Algorithm 1 performs QoS Criteria verifying process as follows. Firstly, the aggregated value of QoS Criteria, of each composite services in CS set , is computed and compared to the corresponding global QoS constraints. The composite service, which satisfies the global QoS constraints, is added to globalverfiedCS, a set of composite services that satisfy global constraints. Secondly, the Utility Value of each composite services in globalverfiedCS is computed and then the optimal composite service, which has the maximum value of utility value, is considered as the optimal composite service CS maxutility_value . Finally, the optimal composite service CS maxutility_value is checked to know if it is the same as supposed optimal composite service CS optimal by checking if the Utility Value of CS maxutility_value is equal to the corresponding value of CS optimal ; if they are the same, the algorithm returns true, otherwise false is returned.

Flight Ticket Purchase: Case Study
In this section, we show an example of how to calculate the similarity of two services by means of Algorithm 1.We provide a case study on QoS-aware composition on domain of Flight ticket purchase. In order to transform composite services from OWL-S into CPNs model, a CPNs based simulation and modeling environment called CPN Tools is used. More details about using CPN Tools is available in [19]. The following is an analysis and discussion about verification of services composition on our case study.

Scenario
The domain of our case study is Flight ticket purchase system. As a user submitted a request for flight ticket purchase, there is a need for five services, namely Flight Seat Availability service, Credit Card service, Ticket Purchase service, Email Confirmation service and Ticket Delivery service. Table 1 introduces the services and their functions.  Table 1 shows, Flight Seat Availability service S 1 checks the available seats according to the submitted request of user then Credit Card service S 2 checks the current balance of a credit card and if purchase procedure can be performed by current card. Ticket Purchase service S 3 performs buying flight tickets for users, Email Confirmation service S 4 sends emails to inform the user about purchase ticket information and Ticket Delivery service S 5 delivers tickets to the address provided by the user.
The scenario of composite service can be expressed as followed: Flight Seat Availability service S 1 should be invoked firstly, followed by Credit Card service S 2 since only if the requested seats are 9. end for 10.
globalverfiedCS  globalverfiedCS CS u 11. end for 12. CS maxutility_value  max_utility_value(globalverfiedCS) // compute QoS utility value of each composite services in globalverfiedCS and find the optimal composite service which has the maximum utility value. 13. if CS maxutility_value is the same CS optimal // checking if the composite service with maximum QoS utility value CS maxutility_value is the same optimal composite service CS optimal by checking if the utility value of CS maxutility_value is equal to the utility value of CS optimal . 14. return

available (Choice composition construction expressed by If-Then-Else control construct in OWL-S).
If the balance of a given credit is not enough to purchase the required tickets, then Credit Card service S 2 is invoked again to check another credit card of the user, and it should be literately invoked until finding the appropriate credit card (Iterated composition construction expressed by Repeat-Until control construct in OWL-S). Then, Ticket Purchase service S 3 will be invoked and two services Email Confirmation service S 4 and Ticket Delivery service S 5 can be executed in parallel, the former one sends an email to the user for confirming the transaction while the latter delivers the ticket to user (expressed by Split-Join control construct in OWL-S). According to the scenario above and using our proposed algebraic model for service composition, composite service can be expressed as follows: S set : S 1 ∆ S 2 ∆ S 3 ∆ (S 4 Ψ S 5 ) (2) where ∆ indicates a sequential operator, indicates an iterative operator and Ψ denotes a parallel operator.

Finding Composite services
As the Flight Ticket scenario is determined and composition and matching process are conducted as shown in [20], there are many available composite services can satisfy the Flight Ticket scenario. After filtering composite services, three composite services are selected according to the descending order of the Utility Value of available composite services in order to apply our QoS verification as in section 3.2.
Among the three composite services, a composite service (denoted by CS optimal ) is considered as the optimal composite service by implementing the approach in [20]. Then, we implement Algorithm 1 to verify QoS criteria of the three composite services, and to validate whether the optimal composite service (denoted by CS`o ptimal ), which is found by implementing ALGORITHM 1, is exactly the determined optimal composite service (CS optimal ) among the three composite services.
The following is the three composite services with its component services, and the values of QoS criteria are included within brackets as the following order: price, duration, availability, reliability and reputation.
(1) Composite service CS1 includes Yiqifei(s1)-> ( Among the three composite services and the result of using the approach in [20] is that CS optimal is CS3. Then, using algorithm 1, we check the three composite services and validate whether the resultant optimal composite service (CS`o ptimal ) is the same CS3. Figure 4 shows a part of Flight Purchase composition model in OWL-S, which includes various types of composition constructions, including Sequence, Parallel and Iteration.

Transforming form OWL-S into CPN
CPN Tools is used to transfer the composition model in Figure 4 into the corresponding composition model in CPN. Figure 5 shows the generated CPNs model of Flight Ticket Purchase.
As shown in Figure 5, all services in OWL-S are mapped to corresponding transitions, and the inputs and outputs of the services are mapped to places associated with data types that are represented by colored sets as shown in the left part of the figure. Control transitions, which are colored with black, directs the flow of components of the composite services. For example, the Out1 place is checked; if there are available flight seats, flag is true which is checked by t1, otherwise it goes through t2 , which means that a flag is false and the process is finished.

QoS aware Verification
For a given set of composite services with an optimal composite service, CS optimal which is determined in advance. Verification process uses ALGORITHM 1, which computes the utility value of each After checking the composition construction types among services, which are sequential, loop and parallel in this case study, and for the sake of simplicity we assume that the credit card service needs one loop (l=1) to find the suitable credit card. Composite services and their related utility value are computed as follows: (1) Utility value of composite service CS 1 : 1) Aggregated value for price (CS 1 .c price )= S 1 .c price +1  S 2 .c price + S 3 .c price + S 4 .c price + S 5 .c price = 10+1  12+3+2+2=29 and CS 1 .c price satisfies the global constraint as 29 30.

3)
Aggregated value for availability (CS 1 .c availability ) = s 1 .c availability  (1  s 2 .c availability )  s 3. c availability  min(S 4 .c availability ,S 5 .c availability )= 0.3  (1  0.7)  0.3  min(0.6,0.7)=0.0378 and CS 1  (2) Using the same steps above, we can compute the utility value of CS2 and CS3. After computing the aggregated value for each QoS criteria, we found that none of them in either CS2 or CS3 violet the global composite constraints and the utility value is computed and the results are as follows: Utility (CS2) =0.5429, Utility (CS3) =0.648.
(3) Finally, we found that the composite service CS3 has the highest utility value which is the same composite service given as the optimal composite service as they have same utility value. Then QoS criteria is validated and the service composition process and given composite service has no QoS inconsistency.

Conclusions
In this paper, a colored Petri Net based model was defined for services composition. Basically in this model, component services and their composition construction types in composite services were transferred from OWL-S to CPN using a tool called CPN tool. In addition, an algorithm was defined to verify the QoS consistency of services composition. A case study is provided to verify the result of an approach of services composition and to check the QoS consistency of services composition using the algorithm mentioned in our study.
It is clear from the above work that our approach can assist on verifying generated composite services. The results of case study obviously suggest that our study should be considered in performing verification of services composition. The method is found to be effective and efficient, due to the comprehensibility of its underlying and the straightforward computation process.
As the verification work in our approach discussed only the inconsistency of QoS criteria, future work shall involve services composition for other verification issues such as Reachability and Deadlock.