The Bar Scenario Conversation


At this point we are ready to tackle an entire WSCL interface. Accordingly, the bar conversation is presented in full in Figure 5-18.

We've already covered all of WSCL, so the interface shown in Figure 5-18 doesn't hold any significant surprises. However, there are a number of elements whose function is interesting, particularly those Interaction elements that have multiple possible OutboundXMLMessages and the corresponding Transition elements which possess a SourceInteractionCondition. Take for example the billing aspect of the conversation, which involves the following interactions:

Figure 5-18. The complete WSCL bar conversation.
 <?xml version="1.0" encoding="UTF-8"?> <wscl:Conversation   xmlns:wscl="http://www.w3.org/2002/02/wscl10"   name="BarConversation" initialInteraction="Start"   finalInteraction="End"   targetNamespace="http://example.org/conversations/bar"   description="Simple bar conversation" >   <!-- Declare the possible interactions that can occur.   This effectively creates the arcs between the nodes in the   conversation state machine. -->   <wscl:ConversationInteractions>     <wscl:Interaction  interactionType="Empty"/>     <wscl:Interaction          interactionType="ReceiveSend" >       <wscl:InboundXMLDocument            hrefSchema="http://conversations.example.org/bar/CustomerGreetingMessage"               />       <wscl:OutboundXMLDocument             hrefSchema="http://conversations.example.org/bar/StaffGreetingMessage"            />     </wscl:Interaction>     <wscl:Interaction interactionType="ReceiveSend" >       <wscl:InboundXMLDocument               hrefSchema="http://conversations.example.org/bar/CustomerOrderMessage"            />       <wscl:OutboundXMLDocument             hrefSchema="http://conversations.example.org/bar/OrderUnavailableMessage"          />       <wscl:OutboundXMLDocument               hrefSchema="http://conversations.example.org/bar/OrderAvailableMessage"            />     </wscl:Interaction>     <wscl:Interaction interactionType="SendReceive" >       <wscl:OutboundXMLDocument               hrefSchema="http://conversations.example.org/bar/OrderExtensionMessage"            />       <wscl:InboundXMLDocument              hrefSchema="http://conversations.example.org/bar/EndCustomerOrderMessage"           />       <wscl:InboundXMLDocument               hrefSchema="http://conversations.example.org/bar/CustomerOrderMessage"            />     </wscl:Interaction>     <wscl:Interaction interactionType="SendReceive" >       <wscl:OutboundXMLDocument               hrefSchema="http://conversations.example.org/bar/OrderMessage"            />       <wscl:InboundXMLDocument              hrefSchema="http://conversations.example.org/bar/CustomerOrderAckMessage"           />     </wscl:Interaction>     <wscl:Interaction interactionType="SendReceive" >       <wscl:OutboundXMLDocument               hrefSchema="http://conversations.example.org/bar/BillMessage"            />       <wscl:InboundXMLDocument               hrefSchema="http://conversations.example.org/bar/BillPaymentMessage"            />     </wscl:Interaction>     <wscl:Interaction interactionType="Send" >       <wscl:OutboundXMLDocument               hrefSchema="http://conversations.example.org/bar/BillPaidMessage"            />       <wscl:OutboundXMLDocument            hrefSchema="http://conversations.example.org/bar/InsufficentPaymentMessage"         />     </wscl:Interaction>     <wscl:Interaction interactionType="SendReceive" >       <wscl:OutboundXMLDocument               hrefSchema="http://conversations.example.org/bar/RepeatOrderMessage"            />       <wscl:InboundXMLDocument           hrefSchema="http://conversations.example.org/bar/RepeatOrderDecisionMessage"         />     </wscl:Interaction>     <wscl:Interaction interactionType="ReceiveSend" >       <wscl:InboundXMLDocument               hrefSchema="http://conversations.example.org/bar/CustomerGoodbyeMessage"            />       <wscl:OutboundXMLDocument               hrefSchema="http://conversations.example.org/bar/StaffGoodbyeMessage"            />     </wscl:Interaction>     <wscl:Interaction  interactionType="Empty"/>   </wscl:ConversationInteractions>   <!-- Declare the conditions under which transitions can occur.   This effectively creates the guards which allow/prevent   arcs from being traversed in the conversation state machine. -->   <wscl:ConversationTransitions>     <wscl:Transition>       <wscl:SourceInteraction href="Start"/>       <wscl:DestinationInteraction href="Greeting"/>     </wscl:Transition>     <wscl:Transition>       <wscl:SourceInteraction href="Greeting"/>       <wscl:DestinationInteraction href="Order"/>     </wscl:Transition>     <wscl:Transition>       <wscl:SourceInteraction href="Order"/>       <wscl:DestinationInteraction href="ExtendOrder"/>       <wscl:SourceInteractionCondition href="OrderAvailable"/>     </wscl:Transition>     <wscl:Transition>       <wscl:SourceInteraction href="Order"/>       <wscl:DestinationInteraction href="Order"/>       <wscl:SourceInteractionCondition href="OrderUnavailable"/>     </wscl:Transition>     <wscl:Transition>       <wscl:SourceInteraction href="ExtendOrder"/>       <wscl:DestinationInteraction href="Order"/>     </wscl:Transition>     <wscl:Transition>       <wscl:SourceInteraction href="ExtendOrder"/>       <wscl:DestinationInteraction href="Serve"/>     </wscl:Transition>     <wscl:Transition>       <wscl:SourceInteraction href="Serve"/>       <wscl:DestinationInteraction href="Bill"/>     </wscl:Transition>     <wscl:Transition>       <wscl:SourceInteraction href="Bill"/>       <wscl:DestinationInteraction href="ProcessBill"/>     </wscl:Transition>     <wscl:Transition>       <wscl:SourceInteraction href="ProcessBill"/>       <wscl:DestinationInteraction href="Bill"/>       <wscl:SourceInteractionCondition href="BillUnpaid"/>     </wscl:Transition>     <wscl:Transition>       <wscl:SourceInteraction href="ProcessBill"/>       <wscl:DestinationInteraction href="Goodbye"/>       <wscl:SourceInteractionCondition href="BillSettled"/>     </wscl:Transition>     <wscl:Transition>       <wscl:SourceInteraction href="Goodbye"/>       <wscl:DestinationInteraction href="End"/>     </wscl:Transition>   </wscl:ConversationTransitions> </wscl:Conversation> <wscl:Interaction interactionType="SendReceive" >   <wscl:OutboundXMLDocument          hrefSchema="http://conversations.example.org/bar/BillMessage"        />   <wscl:InboundXMLDocument          hrefSchema="http://conversations.example.org/bar/BillPaymentMessage"        /> </wscl:Interaction> <wscl:Interaction interactionType="Send"        >   <wscl:OutboundXMLDocument          hrefSchema="http://conversations.example.org/bar/BillPaidMessage"        />   <wscl:OutboundXMLDocument   hrefSchema="http://conversations.example.org/bar/InsufficentPaymentMessage"   /> </wscl:Interaction> 

These interactions show the back-and-forth of paying for drinks (with the possible error condition that the wrong amount is tendered) and are joined together by this transition:

 <wscl:Transition>   <wscl:SourceInteraction href="Bill"/>   <wscl:DestinationInteraction href="ProcessBill"/> </wscl:Transition> <wscl:Transition>   <wscl:SourceInteraction href="ProcessBill"/>   <wscl:DestinationInteraction href="Bill"/>   <wscl:SourceInteractionCondition href="BillUnpaid"/> </wscl:Transition> <wscl:Transition>   <wscl:SourceInteraction href="ProcessBill"/>   <wscl:DestinationInteraction href="Goodbye"/>   <wscl:SourceInteractionCondition href="BillSettled"/> </wscl:Transition> 

These transitions describe the fact that the barman and the customer are allowed to go their separate ways once the bill has been settled. Importantly, the final transition from ProcessBill to Goodbye is guarded by a SourceInteractionCondition which declares that the BillSettled message must have been issued by the barman before the transition could occur.



Developing Enterprise Web Services. An Architect's Guide
Developing Enterprise Web Services: An Architects Guide: An Architects Guide
ISBN: 0131401602
EAN: 2147483647
Year: 2003
Pages: 141

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net