In the past, I developed a demo on “How to Call Orchestration from another project or from another BizTalk Application” that you can read here and where you can download the source code.
This demo was composed by one Visual Studio Solution with two different projects:
However, there were a few questions about how we can accomplish that using two different solutions… well is the exact same process, but to help clarify this topic and to better help the community members that placed the questions I decided to create a different demo.
In this demo we will create two Visual Studio Solution:
- CallExternalOrchestrationCommonSolution with a common orchestration that will be called from others orchestrations
- This will be deployed to a BizTalk Application called “CallExternalOrchestration.Common”
- CallExternalOrchestrationMainSolution with the main Orchestration that will call the common Orchestration using the “Call Orchestration” shape.
- This will be deployed to a BizTalk Application called “CallExternalOrchestration”
In both solutions, I will describe the basic steps (or the most important steps) to accomplish this task.
Creating the Common Solution: CallExternalOrchestrationCommonSolution
This project contains an orchestration that will receive two input strings (however you can define other types of input like a message or other object types) and will construct a message that will be sent to a folder on the file system.
Again, I will not explain all the steps to create the entire flow of the orchestration. The most important thing here is to define the “Type Modifier” property of the orchestration.
If we make an analogy with C#, we can say that this property is the same as the Accessibility Levels to C# members or types. The “Type Modifier” property defines the scope of an Orchestration, i.e., it indicates the access restrictions to this Orchestration. An Orchestration can be public, private, or internal.
- If it is Public, it is visible to anyone interacting with the orchestration.
- If it is Private, it is visible to other orchestrations within the same project and namespace.
- If it is Internal, the port type is visible only within the project.
When we create an Orchestration, the default “Type Modifier” is “Internal”. So to be able to call this orchestration from a different Visual Studio Solution or different project we need to set the “Type Modifier” to “Public”.
To set the “Type Modifier” property for an orchestration to “Public” you need to:
- Open the orchestration in Microsoft Visual Studio
- Right-click somewhere in the orchestration designer (except in the shapes otherwise you will go to the shape properties), for example, the green Start shape at the top of the orchestration and select the “Properties Windows” option to display the Orchestration Properties dialog
- Set the “Type Modifier” property to Public as you see in the picture.
Compile and deploy the solution.
Creating the Main Solution: CallExternalOrchestrationMainSolution
The second project basically contains one orchestration that will receive an input message from a folder on the file system and will call a common (or external) orchestration.
Again, I will not explain all the steps to create the entire flow of the orchestration. The most important thing here is to import the reference (DLL) that contain the common orchestration that we want to call.
To import the reference to your project you need to:
- In Solution Explorer, right-click on “References” and select “Add Reference”.
- In the “Add Reference” dialog box, select the “Browse” tab that enables you to browse for a component in the file system.
- Select the components you want to reference, and then click OK.
- You can select multiple components by holding down the CTRL key, provided the components are all on the same tab.
Now if you drag a “Call Orchestration” shape to your orchestration you will be able to select the common orchestration that we created earlier, as you can see in the picture below:
Once again, compile and deploy the solution.
You can download the source code from:
How to Call Orchestrations developed in a different Visual Studio Solution