<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.w3.org/ws/choreography/2004/02/WSCDL/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/ws/choreography/2004/02/WSCDL/
D:\WSCDL.xsd" name="NCName" author="String" version="String" targetNamespace="http://www.altova.com">
	<!--Information Type Definitions for normal quote request response -->
  	<informationType name="quoteReqType" type="tns:quoteReqMsg"/>
	<informationType name="quoteReqAckType" type="tns:quoteReqAckMsg"/>
	<informationType name="quoteRespType" type="tns:quoteRespMsg"/>
	<informationType name="quoteRespAckType" type="tns:quoteRespMsg"/>
	<informationType name="bomReqType" type="tns:bomReqMsg"/>
	<informationType name="bomRespType" type="tns:bomRespMsg"/>
	<informationType name="quoteAcceptType" type="tns:quoteAcceptMsg"/>
	<informationType name="quoteAcceptAckType" type="tns:quoteAcceptAckMsg"/>
	
	<!-- Information Type Definitions for change quote request response -->
	<informationType name="changeQuoteReqType" type="tns:changeQuoteReqType"/>
	<informationType name="changeQuoteReqAckType" type="tns:changeQuoteReqAckType"/>
	<informationType name="changeQuoteRespType" type="tns:changeQuoteRespType"/>
	<informationType name="changeQuoteRespAckType" type="tns:changeQuoteRespAckType"/>
      <informationType name="changeBomRequest" type="tns:changeBomRequestType"/>
	<informationType name="changeBomResponse" type="tns:changeBomResponseType"/>
	
	<!--Tokens for all the information types-->
	<token name="quoteRequest" informationType="tns:quoteReqType"/>
	<token name="quoteRequestAck" informationType="tns:quoteReqAckType"/>
	<token name="quoteResponse" informationType="tns:quoteRespType"/>
	<token name="quoteResponseAck" informationType="tns:quoteRespAckType"/>
	<token name="bomRequest" informationType="tns:bomReqType"/>
	<token name="bomResponse" informationType="tns:bomRespType"/>
	<token name="quoteAccept" informationType="tns:quoteAcceptType"/>
	<token name="quoteAcceptAck" informationType="tns:quoteAcceptAckType"/>
	
	<!-- Tokens for change quote request response -->
	<token name="changeQuoteRequest" informationType="tns:changeQuoteReqType"/>
	<token name="changeQuoteRequestAck" informationType="tns:changeQuoteReqAckType"/>
	<token name="changeQuoteResponse" informationType="tns:changeQuoteRespType"/>
	<token name="changeQuoteResponseAck" informationType="tns:changeQuoteRespAckType"/>
      <token name="changeBomRequest" informationType="tns:changeBomRequest"/>
	<token name="changeBomResponse" informationType="tns:changeBomResponse"/>

	<!-- Tokens for all the Ids-->
	<token name="customerRef" informationType="tns:stringType"/>
	<token name="quoteID" informationType="tns:stringType"/>
	<token name="bomQuoteID" informationType="tns:stringType"/>

	<!-- TokenLocator for quote request response -->
	<tokenLocator tokenName="customerRef" informationType="tns:quoteReqType" query="/Quote/Customer"/>
	<tokenLocator tokenName="quoteID" informationType="tns:quoteRespType" query="/Quote/ID"/>
	<tokenLocator tokenName="quoteID" informationType="tns:quoteAcceptType" query="/Quote/ID"/>
	<tokenLocator tokenName="bomQuoteID" informationType="tns:bomRespType" query="/Quote/ID"/>

	<!-- TokenLocator for change quote request response -->
	<tokenLocator tokenName="quoteID" informationType="tns:changeQuoteReqType" query="/Quote/ID"/>
	<tokenLocator tokenName="quoteID" informationType="tns:changeQuoteRespType" query="/Quote/ID"/>
	<tokenLocator tokenName="bomQuoteID" informationType="tns:changeBomRequest" query="/Quote/ID"/>
	<tokenLocator tokenName="bomQuoteID" informationType="tns:changeBomResponse" query="/Quote/ID"/>

	<!--Role definitions-->
	<role name="Customer">
		<behavior name="customer" interface="tns:Customer_interface_WSDL"/>
	</role>
	<role name="Supplier">
	 	<!-- TODO: consider one agent behavior *agentForService* instead of a behavior for each type of service. -->
		<behavior name="supplierForCustomer" interface="tns:Supplier_Customer_WSDL"/>
		<behavior name="supplierForManufacturer" interface="tns:Supplier_Manufacturer_WSDL"/>
	</role>
	<role name="Manufacturer">
		<behavior name="manufacturer" interface="tns:Manufacturer_interface_WSDL"/>
	</role>
	
	<!-- Relationship definitions -->
	<relationship name="Customer_Supplier">
		<role type="Customer" behavior="customerDummy"/>
		<role type="Supplier" behavior="supplierForCustomer"/>
	</relationship>
	<relationship name="Supplier_Manufacturer">
		<role type="Supplier" behavior="supplierForManufacturer"/>
		<role type="Manufacturer" behavior="manufacturer"/>
	</relationship>

	<!-- Participant definition -->
	<participant name="Customer">
		<role type="Customer"/>
	</participant>
	<participant name="Supplier">
		<role type="Supplier"/>
	</participant>
	<participant name="Manufacturer">
		<role type="Manufacturer"/>
	</participant>
		
	<!--Channel Type definitions-->

 	<channelType name="CustomerChannel">
    		<role type="tns:Customer" behavior="customer"/>
    		<reference>
      		<token type="tns:customerRef_EndPoint"/>
    		</reference>
    		<identity>
      		<token type="tns:customerRef"/>
    		</identity>
  	</channelType>

	<channelType name="SupplierCustomerChannel">
    		<role type="tns:Supplier" behavior="supplierForCustomer"/>
    		<reference>
      		<token type="tns:supplierCustomerRef_EndPoint"/>
    		</reference>
    		<identity>
      		<token type="tns:quoteID"/>
    		</identity>
  	</channelType>

	<channelType name="SupplierManufacturerChannel">
    		<role type="tns:Supplier" behavior="supplierForManufacturer"/>
    		<reference>
      		<token type="tns:supplierManufacturerRef_EndPoint"/>
    		</reference>
    		<identity>
      		<token type="tns:bomQuoteID"/>
    		</identity>
  	</channelType>

	<channelType name="ManufacturerChannel">
    		<role type="tns:Manufacturer" behavior="manufacturer"/>
    		<reference>
      		<token type="tns:manufacturerRef_EndPoint"/>
    		</reference>
    		<identity>
      		<token type="tns:bomQuoteID"/>
    		</identity>
  	</channelType>

	<!-- The root choreography -->
	<choreography name="Quote_Choreography" root="true">
		<choreography name="Customer_Quote_Choreography" root="false">
			<variable name="quoteReq" informationType="quoteReqType" role="Customer"/>
			<variable name="quoteReqAck" informationType="quoteReqAckType" role="Supplier"/>
			<variable name="quoteResp" informationType="quoteRespType" role="Supplier"/>
			<variable name="quoteRespAck" informationType="quoteRespAckType" role="Customer"/>
			<variable name="changeQuoteReq" informationType="changeQuoteReqType" role="Customer"/>
			<variable name="changeQuoteReqAck" informationType="changeQuoteReqAckType" role="Supplier"/>
			<variable name="changeQuoteResp" informationType="changeQuoteRespType" role="Supplier"/>
			<variable name="changeQuoteRespAck" informationType="changeQuoteRespAckType" role="Customer"/>
    			<variable name="customer-channel" channelType="tns:CustomerChannel"/>
   			<variable name="supplier-channel" channelType="tns:SupplierCustomerChannel"/>
			<relationship name="Customer_Supplier"/>
			<choice>
			<workunit name="createQuote" block="true">
				<interaction name="createNewQuote" channelVariable="tns:customer-channel" operation="newQuote" align="true" initiateChoreography="true">
					<participate relationship="Customer_Supplier" fromRole="Customer" toRole="Supplier"/>
					<exchange messageContentType="tns:quoteReqType" action="request">
						<use variable="cdl:getVariable(customerRef,,Customer)"/>
						<populate variable="cdl:getVariable(customerRef,,Supplier)"/>
					</exchange>
					<exchange messageContentType="tns:quoteRespType" action="response">
						<use variable="cdl:getVariable(quoteID,,Supplier)"/>
						<populate variable="cdl:getVariable(quoteID,,Customer)"/>
					</exchange>
				</interaction>
			</workunit>
			<workunit name="changeQuote" block="true">
				<interaction name="changeQuote" channelVariable="tns:customer-channel" operation="changeQuote" align="true" initiateChoreography="true">
					<participate relationship="Customer_Supplier" fromRole="Customer" toRole="Supplier"/>
					<exchange messageContentType="tns:changeQuoteReqType" action="request">
						<use variable="cdl:getVariable(quoteID,,Customer)"/>
						<populate variable="cdl:getVariable(quoteID,,Supplier)"/>
					</exchange>
					<exchange messageContentType="tns:changeQuoteRespType" action="response">
						<use variable="cdl:getVariable(quoteID,,Supplier)"/>
						<populate variable="cdl:getVariable(quoteID,,Customer)"/>
					</exchange>
				</interaction>
			</workunit>
			</choice>
		</choreography>
		<choreography name="Supplier_Quote_Choreography" root="false">
			<variable name="bomReq" informationType="bomReqType" role="Supplier"/>
			<variable name="bomResp" informationType="bomRespType" role="Manufacturer"/>
			<variable name="changeBomReq" informationType="changeBomRequest" role="Supplier"/>
			<variable name="changeBomResp" informationType="changeBomRespType" role="Manufacturer"/>
			<variable name="manufacturer-channel" channelType="tns:ManufacturerChannel"/>
   			<variable name="supplier-channel" channelType="tns:SupplierManufacturerChannel"/>
			<relationship name="Supplier_Manufacturer"/>
			<choice>
			<workunit name="createBomQuote" block="true">
				<interaction name="createNewBomQuote" channelVariable="tns:supplier-channel" operation="newBomQuote" align="true" initiateChoreography="true">
					<participate relationship="Supplier_Manufacturer" fromRole="Supplier" toRole="Manufacture"/>
					<exchange messageContentType="tns:bomReqType" action="request">
						<use variable="cdl:getVariable(bomQuoteID,,Supplier)"/>
						<populate variable="cdl:getVariable(bomQuoteID,,Manufacturer)"/>
					</exchange>
					<exchange messageContentType="tns:bomRespType" action="response">
						<use variable="cdl:getVariable(bomQuoteID,,Manufacturer)"/>
						<populate variable="cdl:getVariable(bomQuoteID,,Supplier)"/>
					</exchange>
				</interaction>
			</workunit>
			<workunit name="changeBomQuote" block="true">
				<interaction name="changeBomQuote" channelVariable="tns:-supplierchannel" operation="changeBomQuote" align="true" initiateChoreography="true">
					<participate relationship="Supplier_Manufacturer" fromRole="Customer" toRole="Supplier"/>
					<exchange messageContentType="tns:changeBomRequest" action="request">
						<use variable="cdl:getVariable(bomQuoteID,,Supplier)"/>
						<populate variable="cdl:getVariable(bomQuoteID,,Manufacturer)"/>
					</exchange>
					<exchange messageContentType="tns:changeBomResponse" action="response">
						<use variable="cdl:getVariable(bomQuoteID,,Manufacturer)"/>
						<populate variable="cdl:getVariable(bomQuoteID,,Supplier)"/>
					</exchange>
				</interaction>
			</workunit>
			</choice>
		</choreography>
	</choreography>
</package>
