<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="http://jbpm.org/examples/atm"
	xmlns:tns="http://jbpm.org/examples/atm" xmlns:acc="http://jbpm.org/examples/account"
	xmlns:tic="http://jbpm.org/examples/ticket" xmlns:plt="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
	xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">

	<import namespace="http://jbpm.org/examples/ticket" location="ticket.wsdl" />
	<import namespace="http://jbpm.org/examples/account" location="account.wsdl" />

	<types>
		<schema targetNamespace="http://jbpm.org/examples/atm" xmlns="http://www.w3.org/2001/XMLSchema">
			<complexType name="UnauthorizedAccess">
				<sequence>
					<element name="customerName" type="xsd:string" />
				</sequence>
			</complexType>

			<element name="unauthorizedAccess" type="tns:UnauthorizedAccess" />

			<complexType name="InsufficientFunds">
				<sequence>
					<element name="customerName" type="xsd:string" />
					<element name="amount" type="xsd:double" />
				</sequence>
			</complexType>

			<element name="insufficientFunds" type="tns:InsufficientFunds" />
		</schema>
	</types>

	<message name="connectRequest" />

	<message name="logOnRequest">
		<part name="ticketNo" type="xsd:int" />
		<part name="customerName" type="xsd:string" />
	</message>

	<message name="logOnResponse" />

	<message name="statusResponse">
		<part name="status" type="xsd:string" />
	</message>

	<message name="balanceChange">
		<part name="customerName" type="xsd:string" />
		<part name="amount" type="xsd:double" />
	</message>

	<message name="unauthorizedAccess">
		<part name="detail" element="tns:unauthorizedAccess" />
	</message>

	<message name="insufficientFunds">
		<part name="detail" element="tns:insufficientFunds" />
	</message>

	<portType name="FrontEnd">
		<documentation>bank functions available to ATMs</documentation>

		<operation name="connect">
			<documentation>initiate bank connection</documentation>
			<input message="tns:connectRequest" />
			<output message="tic:ticketMessage" />
		</operation>

		<operation name="disconnect">
			<documentation>terminate bank connection</documentation>
			<input message="tic:ticketMessage" />
		</operation>

		<operation name="status">
			<documentation>retrieve bank connection status</documentation>
			<input message="tic:ticketMessage" />
			<output message="tns:statusResponse" />
		</operation>

		<operation name="logOn">
			<documentation>initiate customer access</documentation>
			<input message="tns:logOnRequest" />
			<output message="tns:logOnResponse" />
			<fault name="unauthorizedAccess" message="tns:unauthorizedAccess" />
		</operation>

		<operation name="logOff">
			<documentation>terminate customer access</documentation>
			<input message="acc:customerMessage" />
		</operation>

		<operation name="getBalance">
			<documentation>retrieve account balance</documentation>
			<input message="acc:customerMessage" />
			<output message="acc:balanceMessage" />
		</operation>

		<operation name="deposit">
			<documentation>increase account balance</documentation>
			<input message="tns:balanceChange" />
			<output message="acc:balanceMessage" />
		</operation>

		<operation name="withdraw">
			<documentation>decrease account balance</documentation>
			<input message="tns:balanceChange" />
			<output message="acc:balanceMessage" />
			<fault name="insufficientFunds" message="tns:insufficientFunds" />
		</operation>
	</portType>

	<binding name="FrontEndBinding" type="tns:FrontEnd">
		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />

		<operation name="connect">
			<soap:operation soapAction="http://jbpm.org/examples/atm/connect" />
			<input>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</input>
			<output>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</output>
		</operation>

		<operation name="disconnect">
			<soap:operation soapAction="http://jbpm.org/examples/atm/disconnect" />
			<input>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</input>
		</operation>

		<operation name="status">
			<soap:operation soapAction="http://jbpm.org/examples/atm/status" />
			<input>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</input>
			<output>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</output>
		</operation>

		<operation name="logOn">
			<soap:operation soapAction="http://jbpm.org/examples/atm/logOn" />
			<input>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</input>
			<output>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</output>
			<fault name="unauthorizedAccess">
				<soap:fault use="literal" name="unauthorizedAccess" />
			</fault>
		</operation>

		<operation name="logOff">
			<soap:operation soapAction="http://jbpm.org/examples/atm/logOff" />
			<input>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</input>
		</operation>

		<operation name="getBalance">
			<soap:operation soapAction="http://jbpm.org/examples/atm/getBalance" />
			<input>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</input>
			<output>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</output>
		</operation>

		<operation name="deposit">
			<soap:operation soapAction="http://jbpm.org/examples/atm/deposit" />
			<input>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</input>
			<output>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</output>
		</operation>

		<operation name="withdraw">
			<soap:operation soapAction="http://jbpm.org/examples/atm/withdraw" />
			<input>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</input>
			<output>
				<soap:body use="literal" namespace="http://jbpm.org/examples/atm" />
			</output>
			<fault name="insufficientFunds">
				<soap:fault use="literal" name="insufficientFunds" />
			</fault>
		</operation>
	</binding>

	<service name="AtmService">
		<port name="FrontEndPort" binding="tns:FrontEndBinding">
			<soap:address location="http://127.0.0.1:8080/Tutorial_bpel_atm_frontEnd" />
		</port>
	</service>

	<vprop:property name="customerId" type="xsd:string">
		<vprop:documentation>customer name property</vprop:documentation>
	</vprop:property>

	<vprop:propertyAlias propertyName="tns:customerId"
		messageType="tns:logOnRequest" part="customerName" />

	<vprop:propertyAlias propertyName="tns:customerId"
		messageType="tns:balanceChange" part="customerName" />
	<vprop:propertyAlias propertyName="tns:customerId"
		messageType="acc:customerMessage" part="customerName" />
	<vprop:propertyAlias propertyName="tns:customerId"
		messageType="acc:accountOperation" part="body">
		<vprop:query>/body/customerName</vprop:query>
	</vprop:propertyAlias>

	<vprop:property name="ticketId" type="xsd:int">
		<vprop:documentation>ticket number property</vprop:documentation>
	</vprop:property>

	<vprop:propertyAlias propertyName="tns:ticketId"
		messageType="tic:ticketMessage" part="ticketNo" />
	<vprop:propertyAlias propertyName="tns:ticketId"
		messageType="tns:logOnRequest" part="ticketNo" />

	<plt:partnerLinkType name="Atm-Front">
		<plt:documentation>
			relationship between the ATM and the process
		</plt:documentation>
		<plt:role name="FrontEnd" portType="tns:FrontEnd" />
	</plt:partnerLinkType>

	<plt:partnerLinkType name="Front-Ticket">
		<vprop:documentation>
			relationship between the process and the ticket issuer
		</vprop:documentation>
		<plt:role name="TicketIssuer" portType="tic:TicketIssuer" />
	</plt:partnerLinkType>

	<plt:partnerLinkType name="Front-Account">
		<plt:documentation>
			relationship between the process and the account system
		</plt:documentation>
		<plt:role name="AccountSystem" portType="acc:AccountSystem" />
	</plt:partnerLinkType>

</definitions>
