BASIS: Behavior Analyzer for Interactive Services v0.1.0
Introduction Download Case Study Contact

Case Study

The case study is an ATM service which is uses pick and event handlers in BPEL. For simpler ATM without event handlers and invoking support service, please go to simple ATM case study page.

The ATM service animates one possible implementation of the Automation Teller Machine that people can use to deposit and withdraw money. The client of the service sends connect requests with an identification string. ATM invokes a support service to get session information, then replies this session information. After receiving the reply from the ATM, the client can logon to the ATM, and then choose the operation to withdraw or deposit some money. After receiving the reply of the operation, the client logoffs from the ATM and finally disconnects the connection. Before disconnecting, the client may logon to the system and perform the above operations again. Beside, after reply the session message to the client, the ATM listens to the status checking request and replies the status to the client.

In the following, the activity diagram of the behavior of the ATM service is given.

The BPEL code is also attached here for convinience.

<bpel:process exitOnStandardFault="yes" name="ATM"
    targetNamespace="http://samples.seg.nju.edu.cn/ATMService"
    xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
    xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
    xmlns:support="http://samples.seg.nju.edu.cn/ATMSupportService/"
    xmlns:tns="http://samples.seg.nju.edu.cn/ATMService"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    
    <bpel:import importType="http://schemas.xmlsoap.org/wsdl/"
        location="atm.wsdl" namespace="http://samples.seg.nju.edu.cn/ATMService"/>
    <bpel:import importType="http://schemas.xmlsoap.org/wsdl/"
        location="atmsupport.wsdl" namespace="http://samples.seg.nju.edu.cn/ATMSupportService/"/>
        
    <bpel:partnerLinks>
        <bpel:partnerLink myRole="service" name="atmFrontEnd" partnerLinkType="tns:atmFrontEndPLT"/>
        <bpel:partnerLink partnerRole="service" name="atmSupport" partnerLinkType="tns:atmSupportPLT"/>
    </bpel:partnerLinks>
    <bpel:variables>
        <bpel:variable messageType="tns:connectRequest" name="connectReq"/>
        <bpel:variable messageType="tns:sessionMessage" name="sessionMsg"/>
        <bpel:variable messageType="tns:statusResponse" name="statusResponse"/>
        <bpel:variable messageType="tns:logonRequest" name="logonReq"/>
        <bpel:variable messageType="tns:logoffRequest" name="logoffReq"/>
        <bpel:variable messageType="tns:operationRequest" name="operationReq"/>
        <bpel:variable messageType="tns:operationResponse" name="operationResponse"/>
        <bpel:variable name="connected" type="xsd:string"/>
        <bpel:variable messageType="support:getNextSessionIDRequest" name="newSessionReq"/>
        <bpel:variable messageType="support:getNextSessionIDResponse" name="newSessionResponse"/>
    </bpel:variables>
    
    <bpel:correlationSets>
        <bpel:correlationSet name="atmInteraction" properties="tns:sessionid"/>
    </bpel:correlationSets>
    
    <bpel:sequence name="ATMMainSequence">
        <bpel:receive createInstance="yes" name="ATMConnectReceive"
            operation="connect" partnerLink="atmFrontEnd"
            portType="tns:atmServicePT" variable="connectReq"/>
        <bpel:invoke inputVariable="newSessionReq"
            operation="getNextSessionID"
            outputVariable="newSessionResponse" partnerLink="atmSupport" portType="support:ATMSupportServicePortType"/>
        <bpel:assign validate="no">
            <bpel:copy>
                <bpel:from>$newSessionResponse.parameters/support:return</bpel:from>
                <bpel:to part="sessionID" variable="sessionMsg"/>
            </bpel:copy>
        </bpel:assign>
        <bpel:reply name="ATMConnectReply" operation="connect"
            partnerLink="atmFrontEnd" portType="tns:atmServicePT" variable="sessionMsg">
            <bpel:correlations>
                <bpel:correlation initiate="yes" set="atmInteraction"/>
            </bpel:correlations>
        </bpel:reply>
        <bpel:assign validate="no">
            <bpel:copy>
                <bpel:from>"true"</bpel:from>
                <bpel:to variable="connected"/>
            </bpel:copy>
        </bpel:assign>
        
        <bpel:scope>
            <bpel:eventHandlers>
                <bpel:onEvent messageType="tns:statusRequest"
                    operation="status" partnerLink="atmFrontEnd"
                    portType="tns:atmServicePT" variable="statusSessMsg">
                    <bpel:correlations>
                        <bpel:correlation initiate="no" set="atmInteraction"/>
                    </bpel:correlations>
                    <bpel:scope>
                        <bpel:sequence>
                            <bpel:assign validate="no">
                                <bpel:copy>
                                    <bpel:from>"ok"</bpel:from>
                                    <bpel:to part="status" variable="statusResponse"/>
                                </bpel:copy>
                            </bpel:assign>
                            <bpel:reply operation="status"
                                partnerLink="atmFrontEnd"
                                portType="tns:atmServicePT" variable="statusResponse"/>
                        </bpel:sequence>
                    </bpel:scope>
                </bpel:onEvent>
            </bpel:eventHandlers>
            
          <bpel:while>
            <bpel:condition>$connected = "true"</bpel:condition>
            <bpel:pick createInstance="no">
              <bpel:onMessage operation="disconnect"
                    partnerLink="atmFrontEnd"
                    portType="tns:atmServicePT" variable="sessionMsg">
                    <bpel:correlations>
                        <bpel:correlation initiate="no" set="atmInteraction"/>
                    </bpel:correlations>
                    <bpel:sequence>
                        <bpel:assign validate="no">
                            <bpel:copy>
                                <bpel:from>"false"</bpel:from>
                                <bpel:to variable="connected"/>
                            </bpel:copy>
                        </bpel:assign>
                        <bpel:exit />
                   </bpel:sequence>
               </bpel:onMessage>
               
               <bpel:onMessage operation="logon"
                    partnerLink="atmFrontEnd"
                    portType="tns:atmServicePT" variable="logonReq">
                    <bpel:correlations>
                        <bpel:correlation initiate="no" set="atmInteraction"/>
                    </bpel:correlations>
                    <bpel:scope>
	                      
                    <bpel:sequence>
                    	<bpel:pick createInstance="no">                    				
                    		<bpel:onMessage operation="deposit"
		                  		partnerLink="atmFrontEnd"
		                  		portType="tns:atmServicePT" variable="operationReq">
		                  		<bpel:correlations>
		                  			<bpel:correlation initiate="no" set="atmInteraction"/>
		                  		</bpel:correlations>
	                        <bpel:sequence>
	                            <bpel:assign validate="no">
	                                <bpel:copy>
	                                    <bpel:from>20</bpel:from>
	                                    <bpel:to part="balance" variable="operationResponse"/>
	                                </bpel:copy>
	                            </bpel:assign>
	                            <bpel:reply operation="deposit"
	                                partnerLink="atmFrontEnd"
	                                portType="tns:atmServicePT" variable="operationResponse"/>
	                        </bpel:sequence>
	                    	</bpel:onMessage>

	                    	<bpel:onMessage operation="withdraw"
                        	partnerLink="atmFrontEnd"
                        	portType="tns:atmServicePT" variable="operationReq">
                        	<bpel:correlations>
                            <bpel:correlation initiate="no" set="atmInteraction"/>
                        	</bpel:correlations>
                        	<bpel:sequence>
                            <bpel:assign validate="no">
                                <bpel:copy>
                                    <bpel:from>10</bpel:from>
                                    <bpel:to part="balance" variable="operationResponse"/>
                                </bpel:copy>
                            </bpel:assign>
                            <bpel:reply operation="withdraw"
                                partnerLink="atmFrontEnd"
                                portType="tns:atmServicePT" variable="operationResponse"/>
                        	</bpel:sequence>
                    		</bpel:onMessage>
                      </bpel:pick>

                      <bpel:receive name="logoff" operation="logoff"
			                    partnerLink="atmFrontEnd"
			                    portType="tns:atmServicePT" variable="logoffReq">
			                    <bpel:correlations>
			                        <bpel:correlation initiate="no" set="atmInteraction"/>
			                    </bpel:correlations>
			                </bpel:receive>
					                
                    </bpel:sequence>
                  </bpel:scope>
              </bpel:onMessage>
            </bpel:pick>
          </bpel:while>

        </bpel:scope>
    </bpel:sequence>
</bpel:process>

The target service code including its WSDL interface declarations can be downloaded here

Then, we give the constructed BPN model (Petri-net based model for BPEL services).

The user behavior requirement of the ATM service is the withdrawal scenario depicted in the following figure, which is a Rational Rose UML Sequence Diagram. The Sequence Diagram represents the withdrawal behavior: after the client logon to the service, some money is successfully withdrawn from the ATM, and then the client logoff from the service and disconnects the connection. In the Sequence Diagram, “_this:_Process” stands the service itself while other communication partners are represented by the form partnerLink: partnerLinkType as in the BPEL definition. In this case, the client is the “atmFrontEnd: atmFrontEndPLT”.

The target service (including BPEL and associated WSDLs and XML Schema), user scenario requirement (UML Sequence Diagram) are provided as input to the BASIS v0.1.0. It will first generate the BPEL-Petri-nets model (BPN model for short) as shown in the above, then perform the behavior analysis on BPN model against user scenario. The behavior analysis result of the ATM service and withdrawal scenario is a set of paths Δ(N, D), where N is the ATM BPM model and D is the withdraw scenario.

There are 12 paths in Δ(N, D). The segment of the path in bold are the exact image segment:















The behavior constraint automaton X(N, D) is as the following figure, where the behavior of the withdrawal scenario is given in bold and italic fonts:

The manipulator services are then constructed. The generated files may be different depending on the choice of "Manipulation choice". Sample input to the BASIS v0.1.0 tool is as below, where the first three inputs are the file locations, and the manipulation choice is made on Behavior extraction.

In the BPN model and behavior constraint automaton, the full message information is as following:

  • connect or c : (atmFrontEnd, tns:atmServicePT, connect, tns:connectRequest)
  • atmSupport or a : (atmSupport, support:ATMSupportServicePortType, getNextSessionID, support:getNextSessionIDRequest)
  • atmSupport response or ar : (atmSupport, support:atmSupportServicePT, nextSessionID, support:getNextSessionIDResponse)
  • connect response or cr: (atmFrontEnd, tns:atmServicePT, connect, tns:sessionMessage)
  • disconnect or dis: (atmFrontEnd, tns:atmServicePT, disconnect, tns:sessionMessage)
  • logon or on: (atmFrontEnd, tns:atmServicePT, logon, tns:logonRequest)
  • logoff or off: (atmFrontEnd, tns:atmServicePT, logoff, tns:logoffRequest)
  • deposit or d: (atmFrontEnd, tns:atmServicePT, deposit, tns:operationRequest)
  • withdraw or w: (atmFrontEnd, tns:atmServicePT, withdraw, tns:operationRequest)
  • deposit response or dr: (atmFrontEnd, tns:atmServicePT, deposit, tns:operationResponse)
  • withdraw response or wr: (atmFrontEnd, tns:atmServicePT, withdraw, tns:operationResponse)
  • check status or cs: (atmFrontEnd, tns:atmServicePT, status, tns:sessionMessage)
  • check status response or csr: (atmFrontEnd, tns:atmServicePT, status, tns:statusResponse)
where the namespaces are tns = “http://samples.seg.nju.edu.cn/ATMService”, support = “http://samples.seg.nju.edu.cn/ATMSupportService/”.

After BASIS finishes the execution, manipulators are generated. The user can deploy the manipulator services to some engine, and then invoke and interact with the BPEL message filter service. The structure of generated manipulator services and behavior constraint automaton is:

output location
--- result_paths.txt: the paths of Δ(N,D) in text format
--- net_atm.xml: the BPN model file in PNML format
--- simp_atm.bpel: the BPEL process after simplification
--- manipulator: directory for generated behavior constraint automaton and manipulator service files.
----- atm.wsdl: the WSDL file of target service
----- ATM_ctrlerBPEL.bpel: the constructed manipulator service - BPEL message filter
----- ATM_aut.txt: the behavior constraint automation X(N, D) in text format
----- ctrler_atm.wsdl: the manipulator service WSDL file for the BPEL message filter
----- ctrlSchema.xsd: the manipulator service XML Schema file of BPEL message filter
----- MessageCheckInstantJWS.wsdl: the manipulator service WSDL file of the Java message checker**

**: Note that the Java message checker service archive is already provided with the downloaded BASIS v0.1.0 archive in the download page.


©2007 SEG NJU Homepage IntroductionDownloadCase StudyContact