Click here to Skip to main content
Click here to Skip to main content

First Footsteps with Orchestrations in BizTalk Server 2004

By , 27 Feb 2006
 

Introduction - First things first!

When I first started learning BizTalk, I was looking for an article that could quickly show me how to build a simple orchestration (also known as "Business Process"). Unfortunately, I was unable to find one, so this is my attempt at demonstrating a simple orchestration. Please note that BizTalk Server 2004 is being used in the entire article.

Loan processing application - orchestration demo

Let us consider a simple loan processing request, where in a customer applies for a loan, and the loan request is either "APPROVED" or "REJECTED" based on the customer's ability to repay the loan.

Loan processing - business process

  1. A customer submits a loan processing request; we will call it a loan request.
  2. A business process determines whether the loan can be "APPROVED" or "REJECTED".
  3. A response is generated by the BizTalk which is sent back to the customer.

Creating the BizTalk project - "LoanProcessing"

Now let's start. Create a new BizTalk Server project in Visual Studio.

Step 1: In the Visual Studio .NET menu, select the File -> New -> "Blank Solution" and type the name "LoanProcessing":

Step 2: In the Solution Explorer, right click on the solution name "LoanProcessing" and select Add -> New Project. In the "Add Project" dialog box, for the type of the project, select "BizTalk Projects". Select the template "Empty BizTalk Project" and create a project named "Loan".

Building the schemas

We need to create two schemas; one is the "Loan Request" and other for "Loan Response". At the end of this section we would be ready with the following artifacts:

  1. LoanRequest.xsd
  2. LoanResponse.xsd

Loan request schema

Step 3: Right-click on the project in the Solution Explorer and select the "Add New Item" option. Then, select the item "Schema" and name it "LoanRequest". When the schema shows up, rename the "Root" element to "LoanRequest". After that, create the child elements: "RequestId", "CustomerName", "LoanAmount", "AssetValue", "DateRequested":

Request Schema Elements
Property Name Property Value
RequestId xs:string
CustomerName xs:string
LoanAmount xs:int
AssetValue xs:int
DateRequested xs:date

Please look at the image below and confirm your schema file:

Loan response schema

Step 4: Right-click on the project in the Solution Explorer and select the "Add New Item" option. Then, select the item "Schema" and name it "LoanResponse". When the schema shows up, rename the "Root" element to "LoanResponse". After that, create the child elements: "RequestId", "CustomerName", "LoanAmount", "Status", "Comments":

Response Schema Elements
Property Name Property Value
RequestId xs:string
CustomerName xs:string
LoanAmount xs:int
Status xs:string
Comments xs:string

Building the map

We need to build a map which would transform a loan request XML document into a loan response XML document. A map in BizTalk is a behind-the-scene XSLT file.

Step 5: Right-click on the project in the Solution Explorer and select the "Add New Item" option. Then, select the item "Map" and name it "LoanRequest-To-LoanResponse-Map". Notice the file name convention used here, "SourceSchemaName-To-TargetSchemaName-Map".

Step 6: Click on the left link "Open Source Schema" and select "LoanRequest". Click on the link "Open Destination Schema" and select "LoanResponse". Complete the mapping as shown in the picture below:

  1. Select the "Scriptoid Function".
  2. Click on the property "Configure Functoid Script".
  3. Select C# as "Script Type", and copy and paste the code in the script function:
public string LoanProcessing(int loanAmount, int assetValue) 
{ 
    if ( loanAmount < assetValue) 
    {    
        return "APPROVED"; 
    } 
    else 
    { 
        return "REJECTED"; 
    } 
}

Building the orchestration (also known as a "Business Process")

In an orchestration, a message is the unit of processing. A "message" will always be processed. A "message" can be of any XML schema type. In this project, we have defined two schemas, so ideally we would have two messages in this orchestration.

Step 7: Right-click on the project in the Solution Explorer and select the "Add New Item" option. Then, select the item "BizTalk Orchestration" and name it "LoanOrchestration":

Step 8: Place three shapes on the "Orchestration Surface":

  1. Receive shape
  2. Transform shape
  3. Send shape

Step 9: Create two messages:

  1. LoanReq, and in the Properties Window, set the message type as "Loan.LoanRequest".
  2. LoanResp, and in the Properties Window, set the message type as "Loan.LoanResponse".

Step 10: Setting the properties for all the shapes:

  1. Select the Receive shape, and in the Properties Window, set the message type as "LoanReq" and "Activate" as True.
  2. Select the Send shape, and in the Properties Window, set the message type as "LoanResp".
  3. Select the Transform shape and set the properties as shown in the figure below:

Step 11: Create two ports (a receive port and a send port).

  1. Receive port: Right-click on the port surface, and select "New Configured Port", and give it a name "ReceivePort", leave all the default properties as it is in the wizard.
  2. Send port: Right-click on the port surface, and select "New Configured Port", and give it a name "SendPort", leave all the default properties as it is in the wizard.

Step 12: Strong name and deployment!!

  1. Create a key file using the "sn -k LoanKey.snk" in the Visual Studio .NET command prompt.
  2. In the Solution Explorer, right-click on the "Loan" Project Properties and select "Assembly" and specify the key file name.
  3. In the Solution Explorer, right-click on the "Loan" Project Properties and select "Deploy".

Step 13: Refresh - BizTalk Explorer and create send port and receive locations.

  1. Please refer to MSDN documentation on how to create send port and receive locations.

Step 14: Test the solution

  1. Place the input file in the receive location. Check the response in the output folder.

Quick takeaways

  1. Always set the Activate property to "true" for the first Receive shape in the orchestration.
  2. The first step in an orchestration is to decide the number of messages flowing through the business process and then creating them.
  3. A BizTalk message is always associated with a schema (except in the case of un-typed messages).
  4. A BizTalk service needs to be re-started every time a deployment is done.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Naveen Karamchetti
Architect
United States United States
Member
Naveen has done his Masters (M.S.) in Computer science, has started his career programming the mainframes and now has more than a decade of programming, development and design experience. Naveen has a sharp eye and keen observation skills. Naveen has worked for several companies and strived hard to build large scale business applications and bringing better solutions to the table.
Quite recently Naveen has built a fairly complex integration platform for a large bank. His hobbies include training, mentoring and research. Naveen spends his free time visiting National Parks nationwide.
 
Naveen has developed the BizTalk Control Center (BCC)
http://biztalkcontrolcenter.codeplex.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralOrchestration deployed and enlisted but output not as expectedmemberbhav27068013 Jan '09 - 0:19 
GeneralThe published message could not be routed because no subscribers were found -updatedmemberbakee127 Oct '08 - 4:34 
QuestionNo subscribers were found ???memberzinc_z15 May '07 - 23:59 
AnswerRe: No subscribers were found ???memberNaveen Karamchetti16 May '07 - 4:03 
GeneralRe: No subscribers were found ???memberzinc_z16 May '07 - 5:13 
GeneralRe: No subscribers were found ???memberzinc_z16 May '07 - 5:39 
Generalfirst steps in orchestrations : Output problemmemberThunderBiz6 Apr '07 - 5:34 
GeneralRe: first steps in orchestrations : Output problemmemberNaveen Karamchetti6 Apr '07 - 5:58 
GeneralFirst Footsteps In Orchestrations:Problemmember1207ashish22 Mar '07 - 7:19 
GeneralRe: First Footsteps In Orchestrations:ProblemmemberNaveen Karamchetti22 Mar '07 - 8:08 
QuestionNeed to Restart Biztalk services on every deployment ?memberSelvan30 Jul '06 - 8:18 
AnswerRe: Need to Restart Biztalk services on every deployment ?memberNaveen Karamchetti22 Mar '07 - 8:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 27 Feb 2006
Article Copyright 2006 by Naveen Karamchetti
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid