| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| ~ Licensed to the Apache Software Foundation (ASF) under one |
| ~ or more contributor license agreements. See the NOTICE file |
| ~ distributed with this work for additional information |
| ~ regarding copyright ownership. The ASF licenses this file |
| ~ to you under the Apache License, Version 2.0 (the |
| ~ "License"); you may not use this file except in compliance |
| ~ with the License. You may obtain a copy of the License at |
| ~ |
| ~ http://www.apache.org/licenses/LICENSE-2.0 |
| ~ |
| ~ Unless required by applicable law or agreed to in writing, |
| ~ software distributed under the License is distributed on an |
| ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| ~ KIND, either express or implied. See the License for the |
| ~ specific language governing permissions and limitations |
| ~ under the License. |
| --> |
| |
| <process |
| name="AsyncProcess" |
| xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/" |
| targetNamespace="uri:com.bptest.process" |
| xmlns:proc="uri:com.bptest.process" |
| xmlns:xs="http://www.w3.org/2001/XMLSchema" |
| xmlns:typ="uri:com.bptest.types" |
| xmlns:resp="uri:com.bptest.responder" |
| xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" |
| expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"> |
| |
| <import location="AsyncProcess2.wsdl" |
| namespace="uri:com.bptest.process" |
| importType="http://schemas.xmlsoap.org/wsdl/" /> |
| |
| <partnerLinks> |
| |
| <partnerLink |
| partnerLinkType="resp:AsyncCallerResponderLT" |
| name="AsyncResponder" |
| myRole="Caller" |
| partnerRole="Responder" |
| initializePartnerRole="yes" /> |
| |
| <partnerLink name="Client" |
| partnerLinkType="proc:ProcessCallerLT" |
| myRole="Process"/> |
| </partnerLinks> |
| |
| <variables> |
| <variable messageType="proc:ProcessInputMessage" name="Input"/> |
| <variable messageType="proc:ProcessOutputMessage" name="Output"/> |
| </variables> |
| |
| <sequence name="Main"> |
| <receive |
| createInstance="yes" |
| operation="Run" |
| partnerLink="Client" |
| portType="proc:ProcessPT" |
| variable="Input"/> |
| |
| <scope name="scope1"> |
| <variables> |
| <variable name="OrderCounter" type="xs:int"/> |
| <variable name="OrderCount" type="xs:int"/> |
| </variables> |
| |
| <sequence> |
| <assign> |
| <copy> |
| <from expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"> |
| count(bpws:getVariableData('Input', 'payload', '/typ:AllOrders')/typ:Order) |
| </from> |
| <to variable="OrderCount"/> |
| </copy> |
| <copy> |
| <from expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0" > |
| 1 |
| </from> |
| <to variable="OrderCounter"/> |
| </copy> |
| <copy> |
| <from variable="Input" part="payload"/> |
| <to variable="Output" part="payload"/> |
| </copy> |
| </assign> |
| |
| <while> |
| <condition> |
| bpws:getVariableData('OrderCounter') <= bpws:getVariableData('OrderCount') |
| </condition> |
| <scope name="scope2"> |
| |
| <variables> |
| <variable name="Request" messageType="resp:AsyncRequestMessage"/> |
| <variable name="Response" messageType="resp:ResponseMessage"/> |
| </variables> |
| |
| <correlationSets> |
| <correlationSet name="OrderCorrelator" properties="resp:OrderId"/> |
| </correlationSets> |
| |
| <sequence> |
| <assign name="assign"> |
| <copy> |
| <from> |
| <literal> |
| <typ:AsyncRequest> |
| <typ:Order/> |
| <typ:CallbackEndpoint/> |
| </typ:AsyncRequest> |
| </literal> |
| </from> |
| <to variable="Request" part="payload"/> |
| </copy> |
| <copy> |
| <from>bpws:getVariableData('Input','payload')/typ:Order[number(bpws:getVariableData('OrderCounter'))]</from> |
| <to>$Request/payload/typ:AsyncRequest/typ:Order</to> |
| </copy> |
| <copy> |
| <from>'http://localhost:8090/ode/soap/AsyncProcess/ProcessSVC/CallbackPORT'</from> |
| <to>$Request/payload/typ:AsyncRequest/typ:CallbackEndpoint</to> |
| </copy> |
| </assign> |
| <if name="switch"> |
| <condition>bpws:getVariableData('Request', 'payload', '/typ:AsyncRequest/typ:Order/typ:OrderType/text()') = 'BookOrder'</condition> |
| <invoke name="BookOrderInvoke" |
| operation="BookOrder" |
| inputVariable="Request" |
| partnerLink="AsyncResponder" |
| portType="resp:ResponderPT"> |
| |
| <correlations> |
| <correlation set="OrderCorrelator" initiate="yes" pattern="out" /> |
| </correlations> |
| </invoke> |
| <else> |
| <invoke name="PaperOrderInvoke" |
| operation="PaperOrder" |
| inputVariable="Request" |
| partnerLink="AsyncResponder" |
| portType="resp:ResponderPT"> |
| |
| <correlations> |
| <correlation set="OrderCorrelator" initiate="yes" pattern="out" /> |
| </correlations> |
| </invoke> |
| </else> |
| </if> |
| |
| <pick createInstance="no" name="pick"> |
| <onMessage |
| operation="Callback" |
| variable="Response" |
| partnerLink="AsyncResponder" |
| portType="resp:CallbackPT"> |
| |
| <correlations> |
| <correlation set="OrderCorrelator" initiate="no" /> |
| </correlations> |
| |
| <assign> |
| <copy> |
| <from>$Response/payload/typ:AsyncRequest/typ:Order</from> |
| <to>$Output/payload/typ:AllOrders/typ:Order[number(bpws:getVariableData('OrderCounter'))]</to> |
| </copy> |
| </assign> |
| </onMessage> |
| </pick> |
| |
| <assign> |
| <copy> |
| <from>bpws:getVariableData('OrderCounter') + 1</from> |
| <to variable="OrderCounter"/> |
| </copy> |
| </assign> |
| |
| </sequence> |
| </scope> |
| |
| </while> |
| </sequence> |
| </scope> |
| |
| <reply |
| operation="Run" |
| variable="Output" |
| partnerLink="Client" |
| portType="proc:ProcessPT"/> |
| |
| </sequence> |
| </process> |