Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Codelessly Orchestrate your Business Processes with Microsoft BizTalk 2004 : Page 3

When business process and rules can be described to a runtime engine instead of programmed in code, a lot of problems get solved. Take this hands-on introductory lesson to Microsoft's BizTalk and learn how to abstract your apps with enterprise class.

Building your Workflow
Figure 4. Trading Along: The Workflow for the ShareTrader application is shown, but exclamation points indicate that it's incomplete.
The workflow is the heart of your application. Here is where you visually design the flow of the system, and describe the logic that each step will follow. The BizTalk Orchestration designer is the main tool for this. You will be building the workflow as a DLL that consumes the schema and pipelines that you built earlier, so you will need a second project in your solution to handle this. To do this, select the ShareTrader solution and select Add followed by New Project. In the dialog box select Empty BizTalk Server Project and call it ShareTraderWorkflow.

Add a new item of type BizTalk Orchestration to the project and call it ShareTraderWorkflow.odx. The workflow designer will open, showing the workflow in Figure 4.

You will notice the exclamation mark on a number of the shapes within this workflow. This simply denotes that the configuration is incomplete. In the next step you will complete these fully.

The documents that fuel this workflow are in the schemas DLL that you constructed earlier, so, from this project you need to reference them. To do this you open the references node of the ShareTraderWorkFlow project and select Add Reference. On the Projects tab you then double click ShareTraderSchema to add it to the selected components list. Click OK to exit the dialog.

You will now assign instance variables based on the contents of the schema to the workflow orchestration by creating BizTalk Message Instance Variables with the designer. To do this, select the Orchestration View tab beside the Solution Explorer. Right-click Messages, and select New Message. A message called Message_1 will be created for you. Change its Identifier property to RequestTradeInstance. On the MessageType property, expand Schemas and then choose Select from Referenced Assembly. A dialog will appear. On this dialog, select the MakeRequest schema you built earlier. Repeat this process for a message called DenyTradeInstance, mapped to the DenyRequest schema.

Interfacing with the Rest of the World
BizTalk interfacing is done through ports. The workflow has three interfaces to the outside world, the input interface to get the trade request and the output interfaces for sending the request to either the broker or the trading system. To keep this example relatively simple, the file system will be used as the interface, namely if a file is dropped in a specific directory, the GetRequest port will intercept and handle it, and the output to the broker or the trading system will be simulated by outputting the flat file to the relevant directory.

To configure the ports you drag the Port shape from the toolbox to the Port Surface area on the workflow. The Port Configuration wizard will launch. For the first port use the following settings:

Name: PortGetRequest
Port Type: Create New
PortTypeName: GetRequestPort
Communication Pattern: One Way
Access Restrictions: Internal
Direction: Always receiving
Binding: Specify Now
Transport: File

On the GetRequest shape, set RequestTradeInstance as the Message and PortGetRequest.Operation_1.Request as the operation.

Drag another port to the port surface. On the wizard, use the following settings.

Name: PortSendToTradeSystem
Port Type: Create New
Port Type Name: SendToTradeSystemPort
Communication Pattern: One Way
Access Restrictions: Internal
Port Direction of Communication: Always Sending
Port Binding: Specify Now
URI: C:\DecXBT\OutSystem
Transport: File

On the SendMessageToSystem shape, set Message to RequestTradeInstance and set Operation to PortSendToTradeSystem.Operation_1.Request. Repeat these steps for PortSendToBroker and attach it to the SendMessageToBroker shape in the same way you did for SendMessageToSystem. Make sure the URI is C:\DevXBT\OutBroker to send the file to the different directory.

At this point you will notice that the ConstructMessage_1 shape still has an exclamation mark on it, showing that it hasn't been properly configured yet. In a real system you may have to translate the message from the GetRequest schema to a specific one used by the trading system. You would do that by amending this shape and associating it with a map. For now you are building a simple passthrough so you can delete the shape.

Finally you will notice that the SendToSystem shape to the left of the branch still have the exclamation icon mark on it, showing that it isn't fully configured. What hasn't yet been entered is the Rule that we specifie—if the deal is for less than 5,000 shares we let the system handle it. This is done using the XLANG language.

Select the exclamation mark smart tag and you will be presented with an option to edit the expression in the expression editor. Type the following:

RequestTradeInstance.Body.Number < 5000

Finally on the GetRequest shape, set the Activate property to True.

You can now build your solution. Don't forget to set the Strong Name assembly key file property on the Property pages for the workflow project.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date