HomeDigital EditionSys-Con RadioSearch Web Services Cd
B2B Beginning WS Business Process Management Case Studies Content Management Distributing Computing e-Business Electronic Data Interchange Enterprise Industry Insight Integration Interviews Java & Web Services .NET Portal Product Reviews Scalability & Performance Security SOAP Source Code UDDI Wireless WS Standards WS Tips & Techniques WSDL WS Editorials XML

Web Services Orchestration and Choreography by Chris Peltz
WSJ Vol 03 Issue 07 - pg.35



Listing 1: WSCI Example

<process name="Purchase" instantiation="message">
	<sequence>
		<action name="ReceiveOrder" role="Agent" operation= "tns:Order">
		</action>
		<action name="Confirm" role="Agent" operation="tns:Confirm">
			<correlate correlation="tns:ordered"/>
			<call process="tns:Purchase"/>
		</action>
	</sequence>
</process>

Listing 2:  Illustration of a sequence in BPEL4WS

<sequence>
		<receive partner="buyer" ...
		operation="sendOrder" cariable="request"/>
		<invoke partner="supplier" ...
operation="request" inputVariable="itemreq" outputVariable="itemqt"/>
		<reply partner="buyer" ... operation="response" variable="
     proposal"/>
</sequence>

Listing 3: Define partner roles in BPEL4WS

<partnerLinks>
	<partnerLink name="Buyer" partnerLinkType="po:requestQuoteLinkType"
		myRole="Purchaser"/>
	<partnerLink name="Supplier1" partnerLinkType=
	"po:requestPartQuoteLinkType"
		myRole="Requestor" partnerRole="Purchaser"/>
	<!--Set up other suppliers used in this process -->
</partners>

Listing 4: Partner link types defined in WSDL

	<!-- partnerLinkType defined in the WSDL document -->
	<plnk:partnerLinkType name="requestQuoteLinkType">
	.	<plnk:role name="Purchaser">
			<plnk:portType name="po:request_quote"/>
		</plnk:role>
	</plnk:partnerLinkType>

Listing 5: BPEL4WS variables required for the process

<variables>
	<variable name="request" messageType="po:request"/>
    	<variable name="part_request messageType="po:part_request"/>
    	<variable name="part_quote" messageType="po:part_quote"/>
    	<variable name="proposal" messageType="po:proposal"/>
</variables>

Listing 6: Correlation properties defined in WSDL

<definitions name="properties" ...>
<bpws:property name="quoteID" type="xsd:string"/>
</definitions>
	<definitions name="correlatedMessages ..>
		<bpws:propertyAlias propertyName="cor:quoteID"
		messageType="po:part_quote" ...>
	</definitions>

Listing 7:  BPEL4WS process flow for the scenario

<sequence>
    <receive name="receive" partnerLink="Buyer" operation="request"
			variable="request" initiate="yes">
    </receive>
    <flow name="supplier_flow">
      	<invoke name="quote_supplier1" partnerLink="Supplier1"
		 operation="request_quote"
      		inputVariable = "part_request" outputVariable="part_quote">
      	</invoke>
			<!-- invoke other suppliers as part of the process, done
       in parallel -->
    </flow>
    <!-- construct a proposal from the part quotes received
      -->
    <reply name="reply" partnerLink="Buyer" operation="send_proposal"
	 variable="proposal">
    </reply>
</sequence>

Listing 8: Setting Up Fault Handlers

<faultHandlers>
	<catch faultName="cantFulfillRequest">
		<invoke partner="buyer" operation="sendError"
		inputVariable="fault"/>
	</catch>
</faultHandlers>