set in the service agent and each plan can include several web service invoking ... ployment layer (DD layer) and executing& monitoring layer (EM layer).
Composing Web Services Based on Agent and Workflow Jian Cao, Minglu Li, Shensheng Zhang, and Qianni Den Grid Research Center, Computer Science& Technology Department, Shanghai Jiaotong University 200030, Shanghai, P. R. China, {cao-jian, li-ml, sszhang, den-qn}@cs.sjtu.edu.cn
Abstract.. Although web service has been regarded as a basic technology to support the next generation web, there are some deficiencies in this technology. A challenge to web service is how to compose several web services according to the business requirements. A web service composition framework WASC is proposed in the paper. In the WASC, different plans are defined as ECA rule set in the service agent and each plan can include several web service invoking activities. After receiving a request, service agent can determine to invoke which service so that the service independent plan will be turned into a service dependent plan by rewriting ECA rules. At the same time, workflow is used to coordinate the actions of service agents. The structures of WASC and service agent are discussed in the paper.
1 Introduction Web service has been regarded as a basic technology of the next generation web by researchers coming from academy and industry [1]. Comparing with the requirements of the next generation web, web services technology is not capable to play its role so far [2]. One way to overcome some shortcomings of web services is to apply agent technology [3]. To apply agent to web service has been gained more and more attentions. Michael N. Huhns compared difference between web service and agent in web application and he believes the future web service is agent [4]. But he did not put out any methodology in [4]. Many researchers of semantic web putted some methods to enhance the representation capability of service description language in order to make the software agent can inquiry and make use of web service autonomously, for example DAML-S [5]. Some efforts have been recently started to integrate the software agent and the web service communities. The FIPA services group has initiated a specification that enables FIPA agents to use web services infrastructure (e.g. the message transport service), and propose to extend the web services model with the benefits of agent technology [6]. Similarly, AgentCities has established a working group to integrate web services architecture into their AgentCities framework [7]. This working group is examM. Li et al. (Eds.): GCC 2003, LNCS 3032, pp. 948–955, 2004. © Springer-Verlag Berlin Heidelberg 2004
Composing Web Services Based on Agent and Workflow
949
ining the complexity of service descriptions and the dynamic composition of web services in open environments. But Mercedes Amor concluded that the web service community does not seem to be interested in integrating agent technology into its infrastructure so far. Mercedes Amor proposed to integrate web service and software agent technologies through component-based architecture for developing software agents [3], where agent behavior is provided by different plug-ins components. The composition between agent internal components is performed at runtime, allowing the reconfiguration and adaptation of agent behavior to support new interactions, for instance with web services. But in this method, agent can not makes use of a group of web service to react the request from the environment. In the paper, a service composition framework called WASC based on agent and workflow is presented. The service agents play the main roles in WASC. ECA rules are adopted to describe the mental state of the service agent. Service invoking is modeled as an activity of agent plan. Service agent will turn the general plan to the concrete plan by selecting appropriate web services and executing it autonomously at run time. At the same time, workflow is used to coordinate service agents. The paper is organized as follows: section 2 gives an overview of WASC. Section 3 defines service agent. The plan of service agent is discussed in detail in section 4. The last section concludes the whole paper and points out some future works briefly.
2 WASC-A Framework Supporting Web Service Composition Based on Agent and Workflow The framework we proposed is called WASC (Workflow and Agent based Service Composition), see figure 1. The framework is divided into two layers: design& deployment layer (DD layer) and executing& monitoring layer (EM layer). In DD layer, there are altogether three tools. By using service agent design tool, different agents can be produced as a specification in XML and stored in an agent library. Because service invoking will be defined as an activity of agent plan, the tool will be able to access UDDI to obtain the information about a set of selected web services. The user can also model different business processes as workflows through workflow design tool in a graphical interface. Activities in a workflow will be assigned to persons or agents. Agents can be deployed to different computers by service agent deployment tool. In the EM layer, process instantiated from workflow model will be driven by workflow engine. Tasks will be allocated to persons or service agents through a message-oriented middleware (MOM). Service agents run in the containers, which is called service agent running environment. After accepting a task assignment, service agent will invoke certain web services according to the requirements autonomously. For each service agent running environment, there is a monitor tool through which user can start, pause and terminate an agent and trace the messages exchanged among agents and workflow engine.
950
J. Cao et al.
Design& Deployment Layer Workflow sign Tool
Service Agent Design Tool
De-
Service Agent Deployment Tool Agent Monitor
User Interface Workflow Engine
U D D I
M O M
Service Agent Executing Environment Service Service Agent Agent
Workflow Monitor Executing& Monitoring Layer
Service Agent Executing Environment
Web Service Web Service Web Service
Fig. 1. WASC Framework
3 Definition of Service Agent The concept of agent is now Environment of Agent broadly used not only as a model for computer programCommunication Component ming units displaying certain kinds of characteristics but also in a more abstract and Executing &Monitoring Component general way, as a new metaphor for the analysis, specification, and implementation of Plan complex software system [8]. Beliefs The structure of service Capabilities agent is like figure 2. Belief, Action Set capability, intention and Inner Action Intentions commitment are four fundaCommunication mental parts of agent mental Commitments Service Invoking model. Intention is achieved by plan. Plan is a partial orFig. 2. The Structure of Service Agent dered set of activities that is a unit of action executing. Through executing and monitoring component of agent, agent will communicate with the environment and react to the environment autonomously.
Composing Web Services Based on Agent and Workflow
951
The mental model of service agent is defined based on ontology and ECA rules. Definition 1: Suppose BS is the belief structure set, BI is the instance set of belief structure, i.e., belief body set. The belief model BM is composed of belief structure set and belief body set, i.e., BM=. Further more, the belief structure BS can be represented by BS=, where CS is the concept class set of domain of an agent, Rcs stands for the relationship among concept classes. The concept classes in BS come from ontology p that is defined for specific domain and the relationships among these concept classes also come from domain ontology. If BM is defined under ontology p, it can be denoted as pBM. If x is an instance of concept class c, then it is represented by x=∏(c) p ci specializes pcj if and only if any instance of pci is always the instance of pcj and this relationship is represented as pci≤pcj. Obviously specialization (generalization) is a kind of transitive relationship. Capability, commitment and intention are relating to the behavior of an agent and these behaviors usually happen under certain conditions. In the paper, behavior rule is represented by ECA rules [9]. Definition 2: ECA rule can be defined as Reca=, where e is an event to trig the rule, Con is the condition set to reflect the status of the system and environment and Ac is the action set. An ECA rule states that if e happens and the condition set Con can be satisfied then all the actions of Ac will be executed. Events can be composed through composing operators to reflect complex states. Some basic composing operators are as follows: 1) AND: e1 AND e2 means e1 and e2 both happened. 2) OR: e1 OR e2 means at least one of e1 and e2 happened. Any thing happened that can be detected directly by the system will be mapped to an atom event. Through composing operators, complex event can be constructed and detected. The commitment of agent is the fact that if an event happened and condition set of an ECA rule can be satisfied, the action defined in the rule will be executed definitely. The intention of agent can be defined as Ii=, where ei is an event, Ci is a condition set and pi is a plan. Thus the intention of an agent is the fact that a plan will be executed to respond a specific event under certain conditions.
4 The Plan of Service Agent Generally, agent will execute a series of actions to achieve a goal. The execution of actions can be organized as activities. Thus a plan can be regarded as a partial ordered activity network. Definition 3: Plan model can be represented by PM=, where At is the activity set of a plan; RA is the relationship among these activities. RA=DF∪LF, where DF is the data flow set among activities while LF is the logic relationship among activities. DF and LF are both represented by ECA rules. Activity has several states. These states include waiting (W), ready (R), executing (E), completed (C), overtime (T) and abort (A). When an activity changes its state
952
J. Cao et al.
from one to another, an event happens. ECA rules are also applied to define the inner behavior of an activity. Through LF represented by ECA rules, a complex plan can be constructed. The activity of a plan can be decomposed, i.e., an activity can be defined as a sub-plan. If an activity is not divided any more, it is called atom activity; otherwise it is called complex activity. There are altogether three types of action for service agent: 1) Inner Actions: including belief updating, information format transforming and activity status changing; 2) Communication Actions: including sending, receiving, parsing and generating messages; 3) Service Invoking Actions: invoking a specific web service. In order to react to a request coming from environment, service agent should take actions according to a plan. The plan can be created on the fly or defined in advance. If agent should make a new plan to each request, on the one hand, this agent must be intelligent enough so that it will be very complicated and difficulty to design, on the other hand, the efficiency of agent will be too low due to planning is a search process and costs space and time. But if plans are fixed in advance, the ability to adapt to the environment of agent will be reduced greatly. In the paper, Service Independent plans (SI plan) will be defined firstly. When an agent is running, the SI plan will be turned into a Service Dependent plan (SD plan) by rewriting ECA rules. Firstly, we build the simplest SI plan for a Single Service Invoking plan (SSI plan) like Table 1. After a plan is initialized (a1), the belief of agent is changed to the input data format (a2). Then the service is invoked (a3). The result of service invoking may be success, overtime or failure. If invoking process is success, output data will be transformed into belief of agent (a4) and the plan will be ended (a5). If invoking process is overtime or failure, the plan is ended directly (a5). When a specific web service will be invoked, the SSI plan should be rewritten into a SD plan by replacing the of SSI plan with the corresponding parts of specific web service. For a web service wsi, a service description can be defined as Cs i=. Is i, and Os i are the input and output parameter set respectively and they are represented using believe structure of agent. CIs i is the transforming rule for agent beliefs to input parameters of web service which is in XSLT format. COs i is the transforming rule for output parameters of web service to agent beliefs which is also in XSLT format. QoSmin i and QoSmax i are the worst QoS and the best QoS level of this web service. Currently, there are different definitions for QoS of web service and it generally includes time, cost and reliability. Therefore QoS is a multi dimension vector. But if we give each factor a weight and sum up their weighted values then QoS can be regarded as a single dimension factor.
Composing Web Services Based on Agent and Workflow
953
Table 1. The SI Plan for Service Invoking Activity List: a1: logic start activity a2: data transforming activity 1 a3: service invoking a4: data transforming activity 2 a5 logic end activity Data Set and Transformation: D1: input data set of service (in XML format) D2: output data set of service (in XML format) C1: Transforming Rule for Belief to D1 (in XSLT format) C2: Transforming Rule for D2 to Belief (in XSLT format)
Action List: End( ): the action turning the state of activity to complete TransformBelief(): action transforming belief to input data TransformData( ): action transforming output data to belief Invoke(): service invoking action DataFlow(): input data to an activity Event List: Transformed( ): event indicating data has been transformed StartOf( ): event indicating activity status changing from waiting to ready TimeOut(): event indicating an action is over time WS: web service
The SI plan to response a request of environment usually should include several Web Service Invoking activities (WSI activity). In a SI plan, candidate web services will be defined for each WSI activity awsj and denoted by Γ(awsj). According to the data available, output requirement and QoS requirement, appropriate services can be selected. Suppose there are two parameter sets S1 and S2. For ∀x∈S1 ∩ x≠Null ∩ x∏(pcs1), if always ∃y∈S2 ∩ y≠Null ∩ y∏(pcs2) ∩ pcs1≤pcs2, then we call set S1 specify set S2 and denote it as S1≤S2. If S1≤S2 and S2≤S1, then S1=S2. According to this concept, if the data set available is DSa, output data set required is DSr and QoS requirement is QoSr. Then the services which can be invoked in activity awsj is {WSi|(Is i≤DSa) ∩(DSr≤Osi) ∩ (QoSmin i≤QoSr) ∩ (wsi∈Γ(awsj))} Each WSI activity should be expanded by a SSI plan by rewriting SI plan before this plan is executed. In WASC, service agent plays roles in business processes. As a role, agent should have some qualifications to undertake tasks. The qualification is realized by SI plan. Suppose web service set relating to a SI plan is WS, wsi is a specific web service in WS. We have Ipmax=∪I(wsi), Opmin=∩O(wsi). (I ( ) is a function to get the input parameter set of a web service, while O ( ) is a function to get the output parameter set of a web service.) When a request is received by an agent, it can be turned into a service
954
J. Cao et al.
requirement SR=, where Ir is the input data available and Or is the output data requested. If Ipmax≤Ir and Or≤Opmin, then the request can be realized. Under other conditions, whether request can be realized or not will depends on the planning result. In this paper, when we consider whether a service request can be realized by a plan or not, QoS requirement for the plan is not included due to the total QoS of a plan is difficult to calculate. Although simulation or building a mathematical model to calculate QoS is possible, if another web service is selected for a WSI activity, then the whole QoS of the plan will be changed and should be calculated again. Thus, we do not consider the QoS requirement for the whole plan so far. If an agent receives a request, it will start a dynamic planning process to make a SD plan. Suppose the BI is the believe body of an agent, note that the value of BI will be changed during the executing process. K is a sequence set. The following algorithm is to make the agent be capable to generate a SD plan for a request: Algorithm 1: Suppose t, m represent the ids of any two activities in a plan, ψ is the activity set with their states are “Ready”. (1) Executing ECA rules and refresh ψ; (2) Take out an activity from τ, suppose it is at; (3) If at is a logical end activity, judge whether O≤BI is satisfied: If it is not satisfied, then go to (6); Else the planning process is ended; go to (8); If at is a WSI activity then turn to (4); If at is other activity then execute it and return to (1); (4) γt={wsi| wsi∈Γ(awst)∩Is i≤BI}, If γt =Φ, then go to (6); Else add to the tail of K, go to (7); (5) γt=γt \{wst}: If γt =Φ, then go to (6); Else go to (7); (6) Judge whether K is empty or not: If it is empty, then planning process is failure, go to (8); Else take out the last element of K, suppose it is ,let t=m, turn back to (5); (7) From γt, choice a web service wst whose αn=(QoSmin n+QoSmax n)/2 is the largest in γt,replace the with , execute this activity, return (1); (8) End. From the algorithm described above, the planning process of agent is to choice the web service for each WSI activity of the SI plan according to the logic flow of activities. It reduces the complexity than setting up a plan from scratch. But planning process is still a time-consuming task even using this method. We can use case based reasoning technology to reduce the planning load of agent. This method will not be discussed in the paper.
Composing Web Services Based on Agent and Workflow
955
5 Conclusions and Future Work To compose a group of web services is very important to construct a service based system. How to compose different web services automatically and dynamically according to the changing requirements is a challenging problem. In the paper, a framework named WASC based on workflow and agent is introduced. Web service invoking is designed as an activity of the agent plan. When agent receives a request, the SI plan will be turned into a SD plan by selecting appropriate web services by agent itself. Since the plan is represented by ECA rules, on the one hand the plan of agent can be very complex, on the other hand turning SI plan to SD plan can be realized by rewriting ECA rules. In the paper, the services to be integrated into agent plan are defined in advance so that the data transforming method can also be defined in advance. It reduces the complexity of dynamical service composing. Now we are trying to extend the service agent ability so that it can search the service automatically. Acknowledgements. This research is supported by two Chinese high technology plans (“863” plan) (Granted Number: 2001AA415310 and 2001AA412010) and Chinese 973 project (No.2002CB312002).
References 1. 2. 3.
4. 5. 6. 7. 8.
9.
McIlraith, S. A., Son, T. C. and Zeng, H.(2002) Semantic Web Services, IEEE Intelligent Systems. Sp. Issue on The Semantic Web, 16(2), p.46-53 M. N. Huhns, Agents as Web Services, IEEE Internet Computing, July/August 2002 Mercedes Amor, Lidia Fuentes, and José María Troya, Putting Together Web Services and Compositional Software Agents, J.M. Cueva Lovelle et al. (Eds.): ICWE 2003, LNCS 2722, pp. 44–53, 2003. Michael N.Huhns, Software Agents: The Future of Web Services, R. Kowalczyk et al. (Eds.): Agent Technology Workshops 2002, LNAI 2592, pp. 1–18, 2003. DAML Services. The DARPA Agent Markup Language Homepage. http://www.daml.org /services /. 2002 FIPA Services. http://www.fipa.org.docs/input/f-in-00050/f-in-00050.html AgentCities Web Services Working Group. http://www.agentcities.org / Activities/ WG/ WebServices Oliveira Eugénio; Fischer Klaus; Stepankova Olga, Multi-agent systems: which research for which applications, Robotics and Autonomous Systems Volume: 27, Issue: 1-2, April 30, 1999, pp. 91-106 A.Goh, et.al. ECA Rule-based Support for Workflows, Artificial Intelligence in Engineering, 15(2001), pp37-46