Tutorial 2

Top  Previous 

The source code for the examples in tutorial two can be copied as text below.

 

<process name="marketplace" targetNamespace="urn:samples:marketplaceService" xmlns:tns="urn:samples:marketplaceService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">

<partners>

         <partner name="seller" serviceLinkType="tns:salesSLT" myRole="sales" />

         <partner name="buyer" serviceLinkType="tns:buyingSLT" myRole="buying" />

  </partners>

<variables>

  <variable name="sellerInfo" messageType="tns:sellerInfoMessage" />

  <variable name="buyerInfo" messageType="tns:buyerInfoMessage" />

  <variable name="negotiationOutcome" messageType="tns:negotiationMessage" />

  </variables>

<correlationSets>

  <correlationSet name="negotiationIdentifier" properties="tns:negotiatedItem" />

  </correlationSets>

<sequence name="MarketplaceSequence">

<flow name="MarketplaceFlow">

<receive partner="seller" portType="tns:sellerPT" operation="submit" variable="sellerInfo" createInstance="yes" name="SellerReceive">

<correlations>

<correlation set="negotiationIdentifier" initiate="yes" />

  </correlations>

  </receive>

<receive partner="buyer" portType="tns:buyerPT" operation="submit" variable="buyerInfo" createInstance="yes" name="BuyerReceive">

<correlations>

  <correlation set="negotiationIdentifier" initiate="yes" />

  </correlations>

  </receive>

  </flow>

<switch name="MarketplaceSwitch">

<case condition="bpws:getVariableData('sellerInfo', 'askingPrice') <= bpws:getVariableData('buyerInfo', 'offer')">

<assign name="SuccessAssign">

<copy>

  <from expression="'Deal Successful'" />

  <to variable="negotiationOutcome" part="outcome" />

  </copy>

  </assign>

  </case>

<otherwise>

<assign name="FailedAssign">

<copy>

  <from expression="'Deal Failed'" />

  <to variable="negotiationOutcome" part="outcome" />

  </copy>

  </assign>

  </otherwise>

  </switch>

  <reply partner="seller" portType="tns:sellerPT" operation="submit" variable="negotiationOutcome" name="SellerReply" />

  <reply partner="buyer" portType="tns:buyerPT" operation="submit" variable="negotiationOutcome" name="BuyerReply" />

  </sequence>

</process>