The type or namespace name does not exist in the namespace.

Issues: The type or namespace name does not exist in the namespace in orchestration.


Reason: When we have start building solution and add orchestration. And after some time we change the name or design of the solution. And then if we create a new orchestration, that orchestration would have different namespace from older solution because solution name has been changed. So if we have two or more orchestration then they have different namespace. That’s why this issue occur when we try to build the solution.

Solution: You need to verify the type namespace in each orchestration, namespace should be unique through out all orchestration in one solution.

in short, Orchestration namespace should be same for all orchestrations under one bizTalk solution



Calling a .net component from BizTalk orchestration

This blog is to explain how to call C# components from BizTalk. I am going to explain this scenario by taking simple example like Addition of two number in C# component and call the C# method from BizTalk Orchestration.

First, we need to create a C# class library by following below steps.

  1. Start–>VisualStudio–>Click on Visual Solution–>File–>New–>Project
  2. Select class library project from the template “Visual C#” like below.


3. Change the project name “ClassLibrary1” to “SumofTwoNumbers” and then click OK.

4. Change the class name from “Class1.cs” to “Sum.cs”.

5.Add below code in .cs file


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace SumofTwoNumbers



   public class Sum


        public Int32 Addition (Int32 Num1, Int32 Num2)


            Int32 Add;

            Add = Num1 + Num2;

            return Add;       




This C# component takes two input parameter and return the sum of the two parameters. These two input parameters need to be passed from BizTalk orchestration for our scenario.

Note: Make sure class should be ‘Serializable’, because when calling instances of class, not marked as Serializable from an orchestration, it must be from an atomic scope. 

6. Provide strong name key for the project and Build it.

7. Once you build the project, one dll gets created in project directory, you need to GAC the dll by using GACUtils tool.

8. Now C# dll is ready to use from BizTalk orchestration.

Follow below steps to create BizTalk application and call above C# method.

9. Create a BizTalk project and add above C# library as reference to the project.


10. Open BizTalk orchestration–>Goto Orchestration view–>Create a new variable name “SumOfTwoNumbersMethod”–>Open Properties of the variable–>Type–>Select <.Net Class..>–>Select project name–>Select Classname from the References.

11. Now we have a BizTalk variable ready which points to the C# class.

12. Now we can use this variable in BizTalk expression shape to pass the input parameters to the method.


//SumOfTwoNumbersMethod—This is the variable which we created above, to point to the C# class.

//Addition—This is the C# method where we have our actual logic.

//InputMsg.Val1—This is the first input parameter to the C# method.

//InputMsg.Val2—This is the second input parameter to the C# method.

//SumOutput – This is the int data type variable which stores the output of the method.

13. Now we have method output stored in the variable “SumOutput”, we can use this variable according to our requirement in the orchestration.

BizTalk Sequential Convoy

This blog is to explain about BizTalk Sequential Convoy.

What is Sequential Convoy?

Sequential Convoy is one type of BizTalk design pattern to achieve particular type of requirements. This can be defined as “A sequential convoy enables multiple single messages to join together to achieve a required result. A sequential convoy is a set of related messages that have a predefined order. Although the messages do not have to be exactly the same, BizTalk Server must receive them in a sequential order.”

Sequential Convoy also called as singleton pattern convoy.

Sample Scenario for Sequential Convoy:

My Orchestration has to receive the messages from source location and create a batch for first three messages and send to destination system.

In order to achieve this requirement, we need to make our orchestration as singleton, that means my orchestration has to receive all 3 messages using single instance (By default, Orchestration creates dedicated instance for each message)

Once my orchestration receives 3 messages, instance will be completed and new instance will be created for next 3 messages. Likewise, my orchestration has to run for ever.

Note: In order to correlate all 3 messages, we need to have common element in all messages (Example: CustomerId/OrderId..)

In real time, usually this type of scenario comes for internet banking transactions or retail orders process.

Sample Input message:

This message has to be dropped 3 times in receive location with different data.

<ns0:Billing xmlns:ns0=”http://BTSamples1.BillingAddress”&gt;


<Address1>ABC Apt</Address1>




Sample Output message:

This message is a batch of 3 input messages.


<ns0:Billing xmlns:ns0=”http://BTSamples1.BillingAddress”&gt;


<Address1>ABC Apt</Address1>




<ns0:Billing xmlns:ns0=”http://BTSamples1.BillingAddress”&gt;


<Address1>BAC Apt</Address1>




<ns0:Billing xmlns:ns0=”http://BTSamples1.BillingAddress”&gt;


<Address1>CDE Apt</Address1>




Note: In all messages we need to have a common element “CustId”.


1. Need to create a schema for incoming message and promote the common element as property promotion. Also create correlation type and correlation set on CustId.


2. Design the orchestration like below.


“Receive_1” shape receives very first message and initialize the correlation set.

“Receive_2 shape follow the correlation and receives remaining messages using the same instance created while receiving first message.

“Loop_2” shape make sure the orchestrations run for ever.

“Loop_1” shape make sure to receive maximum 3 messages for each instance and batch it.

Once max messages (3) are received, “Loop_1” will break and batched message will be sent to Destination system using “Send_1” shape.

3. Create below orchestration variables.

//Count is a variable of type “System.Int32

//Continue is a variable of type “System.Boolean”

//XmlDocVar is a variable of type “System.Xml.XmlDocument”

//StrFinal is a variable of type “System.String”

//BillingStrVar is a variable of type “System.String”

4. Create below Orchestration Messages

//XmlDocMsg is a message of type “System.Xml.XmlDocument

//BillingAddress is a message of type BillingAddress Schema

5. Keep below code in all orchestration shapes.

  • Receive_1


  • Expression_1


  • Loop_2


  • Loop_1


  • Receive_2: 


  • Expression_2


  • Expression_3


  • ConstructMessage_1


  • Send_1


  • Expression_3


6. Build and deploy the application

7. Configure the ports and start the application

8. Unit Testing: Drop couple of sample message copies in input folder with same customer id then for every 3 messages one batch file will be batched and dropped in a destination system. For example, if you drop 6 input messages, you will see 2 output messages in destination folder.



BizTalk Parallel Convoy

This blog is to explain about BizTalk Parallel Convoy.

What is Parallel Convoy?

Parallel Convoy is one type of BizTalk design pattern to achieve particular type of requirements. This can be defined as “A parallel convoy enables multiple single messages to join together to achieve a required result. The set of related messages can arrive in any order, but BizTalk Server must receive all of them before starting the process”

Sample Scenario for Parallel Convoy:

My Orchestration has to produce a customer address which is having Billing and Shipping details.

My Orchestration has to receive the Billing address details from Source A and Shipping Address details from Source B. Once both messages are received, then only my orchestration has to proceed further to produce full customer address. If any one of the addresses are not received, my orchestration has to wait till other message received.

This scenario can be achieved through parallel convoy design pattern in BizTalk.

  1. We need to create 3 schemas, Correlation type and correlation set.
  • Schema1 is for Billing Address


  • Schemas 2 is for Shipping Address


  • Schema 3 is for Full Customer Address



2. Insert “ParallelActions” shape into the BizTalk orchestration editor.

3. Drag and drop two receive shapes inside the parallel convoy shape like below


4. Create a message for Billing Address and assign to the shape “Receive_1”

5. Create a message for Shipping Address and assign to the shape “Receive_2”

6. Set “Initializing Correlation Sets” property for both receive shapes with the correlation set created in above steps.

Please note that both receive shapes are having “Initializing Correlation Sets”.

If Receive_1 shape receives the message first, then other receive shape will act as follow correlation on CustId.

If Receive_2 shape receives the message first, then other receive shape will act as follow correlation on CustId.

Once both messages are received then only It will proceed further to apply a map to produce full customer address.

7. Create a map to produce full customer address

Input messages: Billing and Shipping Addresses


Output Messages: Customer Address



Click on “OK”


8. Send the final message (Full Customer Address) to the destination system based on your requirement.

Here is the sample Orchestration view for Parallel Convoy demo.


We will talk about sequential convoy in upcoming blogs.








BizTalk Correlations

This blog is to explain about BizTalk Correlations.

What is Correlation?

Correlations can be defined as binding incoming messages with the appropriate instance of an orchestration.

Sample Scenario for Correlations:

My Orchestration has to send a request message to a Message Queue, let’s say it is “Input Queue”. Some other process takes the input message from “Input Queue” and after processing, output will be sent to another Queue, let’s say it is “Output Queue”.

Now Orchestration has to receive the message from Output Queue.

Also, my orchestration has to make sure that, it is consuming the output message of the of the correct instance.

How to Implement Correlations:

If we need to implement correlations, both input and output messages should have a common field element. For Example

Input Message:


Output Message:


Also, common element (CustId) should be property promoted.

Go to Orchestration View–>Types–>right click on Correlation Types–>Select New Correlation Type–>Correlation Properties windows appears with two panels.

Left Side Panel is “Available Properties” and the right-side panel is “Properties to correlate on:”

We need to select our property promoted field from left side panel and click on “ADD”, then field will be added to right-side panel. Using this common field, we will correlate request and response messages in the orchestration.


So far, we have created a Correlation Type.

Now we need to create a Correlation Set, which will be used in Orchestration Receive and Send shape properties.

Go to Orchestration View–>right click on Correlation Sets–>Select New Correlation Set->One Correlation set will be created.

Correlation Set properties–>you need to select correlation type which we have created above.


Now we are ready with correlation Sets.

Orchestration Properties:

In orchestration, if we want to send the message out, it will be through send shape. In send shape properties, we need to provide the “Initializing Correlation Set” property and select the correlation set which you have created in above steps.


Similarly, we need to provide “Follow Correlation Set” property in Receive shape which will be used to receive the response message. “Activate” property should be false in this second receive shape of the orchestration.


When you initialize the correlation set, one subscription id will be created for your instance in the message box and when you follow the same correlation set, using the subscription id, correct message will be received for that instance. This mechanism will be taken care by the BizTalk engine internally.

Here is the sample Orchestration view for Correlations demo.


Using these correlations, we will design Convoys (Sequential & Parallel) in upcoming blogs.








BizTalk Logical Ports & Port Bindings

This blog is to explain various ports and port Bindings in Orchestration.

There are two types of ports in BizTalk.

  • Logical Ports: Ports which are used in Orchestration
  • Physical Ports: Ports which are used in BizTalk admin console

Each logical port (Except Direct Binding) should have binding with a physical port in BizTalk admin console

Since this blog is related to orchestration stuff, let’s talk about logical ports.

There are two types of logical ports

Inbound Logical Ports:

These ports are used to receive the messages from message box to Orchestration. These are also called as Subscribers (Subscribing messages from Message box DB)

Outbound Logical Ports:

These ports are used to send the message from Orchestration to message box. These are also called as Publishers (Publishing messages to Message box DB)

How to Create Logical Ports:

  1. When you open the orchestration, you would see below screen


2. Right click on Port Surface–>Select “New Configured Port”



3. Port Configuration Wizard appears and then click on “Next”–>Provide the name of the Port (Port_AppraisalInput)–>Click Next–>Provide PortType Name as “PortType_AppraisalInput”–>Click Next

Communication Pattern:

  • One-Way—Select this option if you want to create oneway port
  • Request-Response – Select this option if you want to create two-way port.

Access Restrictions:

Choose appropriate option based on your requirement



4. Port Direction for Inbound:

For Inbound logical port, select “I’ll always be receiving messages on this port” option.

For Outbound logical port, select “I’ll always be sending messages on tis port” option.


Port Bindings are three types.

  • Specify now
  • Specify Later
  • Direct

Specify now: you need to provide URL, Adapter and Pipeline details in design time itself.


Specify Later: If you select this option, you need to provide the URI, Transport and Pipeline details in BizTalk Admin console.


Direct Binding: This is loosely coupled Binding type. There are three options in Direct Binding and by default first option is selected in the screen. If we use this option, messages are subscribed from message box using filter condition in Receive shape properties.



Self-correlating direct bound ports are self-referential. This means that a self-correlating direct bound port supplies the information that an orchestration can use to send messages back to its enclosing orchestration. Please go through the link below for more details.

Partner Orchestration:

Partner orchestration direct bound ports provide the capability of having inter-orchestration communication through ports. Please go through the link below for more details.

Port Direction for Outbound: For outbound port bindings, you can see additional option as “Dynamic”.

Please see the Dynamic send port details in the below link.




BizTalk Orchestration Shapes

This blog is to describe briefly on various Orchestration shapes.

Receive: Receive shape is used to receive the incoming xml message from message box using Inbound logical port.


Send: Send shape is used to send the outgoing xml message to message box using Outbound logical port.


Transform: Transform shape is used to execute the map from orchestration.


MessageAssignment: Message assignment shape is used to assign a message to another message.


Expression: Expression shape is used to initialize the variables, perform if else conditions and writing event logs.


Construct Message: Construct Message shape is used to construct the message. Only Transform and Message Assignment shapes are allowed within Construct message shape.


Group: Group shape is used to group the shapes in an intuitive and visually manageable way. You can collapse or expand a task to show or hide the actions within it. When you have complex orchestrations, we use the group shape for better visibility.


Call Orchestration: This shape is used to call child orchestration from Parent Orchestration. This shape will be used for synchronous process. When parent orchestration sends the request to child orchestration, child orchestration should send the response back to the caller (Parent Orchestration).


Start Orchestration: This shape is used to call child orchestration from Parent Orchestration. This shape will be used for Asynchronous process. When parent orchestration sends the request to child orchestration, child orchestration would not send the response back to the caller (Parent Orchestration).


Call Rules: This shape is used to call the business rules (BRE) from the orchestration. First, we need to create policies and deploy to Rule Engine DB, Using Call rules shapes we need to select the policies from the orchestration. If the policy has multiple rules, then latest version of the rule (Within the Policy) will be executed on incoming message.


Decide: This shape is used to apply if..else conditions in the orchestration.


Delay: This shape is used to pause the orchestration for a given time.


Listen: This shape is used to listen for a particular message based on Follow Correlation Set property. If the required message is received, it will continue for further process with in Listen block. We need to keep a receive shape in one side and Delay shape other side. If we don’t receive/listen the message with in the timeline mentioned in the delay shape then shapes which are mentioned under delay shape will be executed.


Parallel Actions: This shape is used to execute multiple flows parallelly in the orchestration


Loop: This shape is used to execute series of steps in an orchestration until a certain condition is met.


Scope: A “scope” is a unit or a block which is executed as a context and is associated with a transaction type. In order words, a scope defines a context which maintains the state for a defined unit-of-orchestration code.


Throw Exception: This shape is used to throw the exceptions to catch block


Compensate: This shape is used to roll back the transactions mentioned in the atomic scope. For example, BizTalk code has to insert message header details to Header Table and LineItem details to LineItem table. If any of these operations are failed, this will roll back the previous transactions based on the code written in the shape. Compensate shape can be used within compensation block only. For getting compensation block, right click on Scope shape and select “New Compensation Block”.


Suspend: This shape is used to suspend (Stop the processing) the Orchestration instance. We can resume these instances manually when needed.


Terminate: This shape is used to terminate the Orchestration instance. Orchestration instance is completely removed from BizTalk databases.



Create First BizTalk Orchestration


I need to drop a sample Xml message in a folder location.

Sample Input Xml message:

  <ns0:AppraisalInput xmlns:ns0=”http://SampleBTApp.AppraisalInputSchema”&gt;





My BizTalk orchestration should receive the message and do below validations

If Appraisal Score = 5, then Assign Grade = ‘A’

If Appraisal Score = 4, then Assign Grade = ‘B’

If Appraisal Score = 3, then Assign Grade = ‘C’

Final Output should be sent to a folder location.

Sample Output Xml message:

<ns0:AppraisalOutput xmlns:ns0=”http://SampleBTApp.AppraisalOutputSchema”&gt;







  1. Go to Start Menu–>Open Visual Studio
  2. Click on FILE menu–>New–>Project


3. Below window will be appeared and you need to provide the details for

Name: <<Name of the BizTalk Application>>

Location: <<Where you want to save the app in hard disk>>

Solution name: <<Name of the solution>>

Note: One solution might have different BizTalk projects.



4. Once you click on ‘OK’ button, below screen will be appeared under Solution Explorer.



5. Right Click on the project name “SampleBTApp”–>Add–>NewItem

6. Select Schema and provide the Schema name (Example: AppraisalInputSchema.xsd)


7. Once you click on “Add”, below screen will be appeared.


8. Rename the “Root” record to some meaningful name like “AppraisalInput”

9. Right click on AppraisalInput–>InsertSchemaNode–>ChildFieldElement


10. Once you click on “Child Field Element” below screen will be appeared.


11. Rename the “Field” to “EmpNo”. Similarly create two more fields “EmpName” and “AppraisalScore”.


12. Solution Explorer should look like below.


13. Using above steps, we need to create one more schema “AppraisalOutputSchema” with fields “EmpNo”, “EmpName”, “AppraisalScore” and “Grade”.


14. Solution Explorer should look like below.


15. Save the BizTalk application.

16. So far, we have created two schemas. Now we need to create a Map to derive the Grade of the employee based on some conditions.

17. Right click on BizTalk Application–>Add–>New Item–>Select “Map Files”–>Click on “Map” and provide the MapName


18. You can see three panels, left side panel is to specify Source Schema, right side panel is to specify destination schema and middle panel is to provide mapping details.

Click on “Open Source Schema” link and select Source schema “AppraisalInputSchema” like below.


19. Click on “Open Destination Schema” link and select Destination schema “AppraisalOutputSchema”. You can see the below screen.


20. Now we need to provide the mappings, Hold the mouse left button and drag the lines like below.


21. Now we need to provide the logic for Grade field of destination schema. Hold the mouse left button and drag the “Scripting” functoid from Toolbox to Map panel. Also provide the mapping like below.


22. Double click on Scripting functoid–>Choose middle tab (Script functoid Configuration) and select “Inline C#” from drop down list and provide the code like below.

public string Grade(string param1)


            string GradeVal = string.Empty;

            if (param1 == Convert.ToString(5))

              GradeVal = “A”;

            else if (param1 == Convert.ToString(4))

                GradeVal = “B”;

            else if (param1 == Convert.ToString(3))

                GradeVal = “C”;

                return GradeVal;



23. Click on “OK” button and Save the application.

24. So far, we have created two schemas and one map, now we need to create an orchestration.

25. Solution explorer should look like below.


26. Right click on BizTalk application “SampleBTApp”–>Add–>New Item–>Orchestration Files–>Select “BizTalk Orchestration” and provide the name (EmpGradeOrch) for the Orchestration.


27. Once you click on “Add”, you would see empty orchestration screen like below.


28. You need to place required orchestration shapes in between green and red colour buttons. Below is the list of shapes available in BizTalk orchestration. If you want to add any shape, just right click on the windowàInsert ShapeàChoose required Shape.


29. Orchestration receives the message through “Receive” Shape. So, we need to choose “Receive” shape and provide couple of properties for the shape.

30. If we want to go to properties windows, click “F4” key in keyboard or right click on “Receive“ shape and select “Properties Window”, then properties window appears like below.



31. Here you need to specify below properties

  • Activate: We need to specify the property as “True”, this property creates instance of the orchestration and this is mandatory for orchestration first receive shape. (Mandatory)
  • Description: To provide some description about the shape (Optional)
  • Following Correlation Set & Initializing Correlation Set: While using correlations, you need to specify this property (Optional)
  • Message: Need to specify the message type (Mandatory)
  • Name: To specify some meaningful name for the Receive shape.
  • Operation: Need to choose logical port name here.

32. In BizTalk orchestration, xml messages will be traversed through some message types.

Here we need to create two messages for two schemas (Input and Output).

  • Messages should be created in Orchestration view window.



  • Right click on Messages–>New Message–> Rename the message name to “InputMsg”


  • Right click on “InputMsg”–>Select “PropertiesWindow”



  • Click on “Message Type” drop down list and Expand “Schemas” and select “AppraisalInputSchema”



Same way create one more message “OutputMsg” and select the schema type as “AppraisalOutputSchema”. After this your orchestration view should look like below.


33. Now we need to create logical ports for both incoming and outgoing messages of the orchestration.

Inbound Logical Port:

  • Right click on Port Surface–>Select “New Configured Port”



  • Port Configuration Wizard appears and then click on “Next”–>Provide the name of the Port (Port_AppraisalInput)–>Click Next–> Provide PortType Name as “PortType_AppraisalInput”–>Click Next



  • Click Next –>Click Finish



Outbound Logical Port:

  • Create the Outbound Logical ports using above steps




34. Now we are ready with message types and logical ports. We need to provide these properties to Receive Shape.

35. Go to ReceiveShape properties–>click on Message Drop downlist–>Select InputMsg


Select the Operation as Inbound Logical Port like below.


Now you can see the Orchestration as below.


36. Now we are good with Receive shape properties. Next, we need to apply Map on the Input message received through Receive Shape. We need to use Transform Shape. Insert “Transform” shape under Receive Shape.


37. Transform shape properties–>Message Constructed–>Select “OutputMsg”


38. Double click on Transform shape


39. Select Radio button of “Existing Map” and select Fully Qualified Map Name.


40. Now we need to set Source and Destination messages.




Click OK.

41. So, far we have received Input message through “receive” shape and applied map on using “Tranform” shape. Now we need to send the constructed output message to Message box using Logical Outbound Port. Insert “Send” shape after Transform shape in the Orchestration.


42. Goto SendPort properties and provide Message as “OutputMsg” and choose Operation as Outbound logical port.


43. Now you can see final Orchestration window as below.


44. Now we are ready with Orchestration. Next, we need set few properties to the application. Right click on application–>Properties–>Click on Signing–>Select New–>Provide KeyFileName–>OK


45. Now Select Deployment –>Provide Application Name as “SampleBTApp”


46. Now Right click on Application–>Build




47. Right click on BizTalk application–>Deploy


48. Now we are done with development and deploy the application. Next, few settings need to be done in BizTalk admin console.

49. Start–>AllPrograms–>MicrosoftBizTalk Server 2013R2–>Select “BizTalk Server Administration”


50. Expand BizTalk Server Administration–>Expand BizTalk Group–>Expand Applications–>SampleBTApp


51. Need to Create a receive Port.

Right click on ReceivePorts–>New–>One-way Receive Port–>Provide name of the receive port–>Click on Receive Locations–>Click on New–>Provide ReceiveLocation name–>In “Type” dropdownbox, select “FILE” as adapter type–>Click on Configure–>Browse the Receive Folder where you are going to drop input message–> Click on Apply and OK–>Provide Receive pipeline as “XmlReceive”–> Click on Apply&OK

52. Need to Create a Send port

Right click on Send Port–>New–>Static One-Way Send Port–>Provide Port Name–>Type “File” (Adapter)–>click on Configure–>Browse destination folder where you want to see the output message–>Click OK–>Provide Send Pipeline as “PassThruTransmit”–>Click on “Apply&OK”.

53. Double click on Orchestration–>Bindings–> set Host and Bind Logical ports with physical ports for both receive and send.

54. Drop a sample message in Receive location and you can see the output in Destination location.