Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

BizTalk 2010 Recipes : Adapters - Creating Ports Through C Sharp Applications

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
4/30/2011 4:43:29 PM

1. Problem

You want to create an external .NET application that can be used by administrators to create and modify ports on BizTalk Server.

2. Solution

You can create and modify a variety of components programmatically using the BizTalk Explorer object model. This solution will walk you through creating a basic C# Windows Form application that calls the object model.

NOTE

The Microsoft.BizTalk.ExplorerOM.dll assembly can only be used from 32-bit systems. You can reference it in Visual Studio on a 64-bit system, but it will not work once the code is compiled.

Here are the steps to follow:

  1. In Visual Studio, create a new project of type Windows Forms Application (as shown in Figure 1).

    Figure 1. Creating a Windows Forms Application
  2. Add a reference to the assembly called Microsoft.BizTalk.ExplorerOM.dll. This assembly is located in $\Program Files\Microsoft BizTalk Server 2010\Developer Tools.

  3. Create a new button on the form. The code will be implemented in the code behind this button for this demonstration solution.

  4. Double-click the button to access the code behind, and enter the information listed in Listing 1.

Example 1. Creating Ports in C#
private void button1_Click(object sender, EventArgs e)
{
// instantiate new instance of Explorer OM
BtsCatalogExplorer btsExp = new BtsCatalogExplorer();

// connection string to the BizTalk management database where the ports will be created
btsExp.ConnectionString = "Server='SR';Database='BizTalkMgmtDb';Integrated Security=true";

// new BizTalk application
Microsoft.BizTalk.ExplorerOM.Application app = btsExp.AddNewApplication();
app.Name = "AppCreatedInCode";
btsExp.SaveChanges();

// new BizTalk File Send Port
SendPort send = app.AddNewSendPort(false, false);
send.Name = "SendCreatedInCode";


send.PrimaryTransport.TransportType = btsExp.ProtocolTypes["File"];
send.PrimaryTransport.Address = "C:\\Drops";
send.SendPipeline = btsExp.Pipelines["Microsoft.BizTalk.DefaultPipelines.PassThruTransmit"];

// new BizTalk WCF-BasicHttp Receive Port
ReceivePort receive = app.AddNewReceivePort(false);
receive.Name = "ReceiveCreatedInCode";
receive.PrimaryReceiveLocation.TransportType = btsExp.ProtocolTypes["WCF-BasicHttp"];
receive.PrimaryReceiveLocation.Address = "http://demo/demofolder";
receive.PrimaryReceiveLocation.ReceivePipeline =
btsExp.Pipelines["Microsoft.BizTalk.DefaultPipelines.XmlReceive"];

// save all of the changes
btsExp.SaveChanges();
}


3. How It Works

You can access a wide variety of functionality through the BizTalk ExplorerOM assembly, including ports, applications, orchestrations, bindings, and party information. When using the BizTalk Administration Console is not the ideal option, the Explorer Object Model opens up a number of programmatic options.
Other -----------------
- BizTalk 2010 Recipes : Adapters - Configuring SOAP Sends and Receives
- Windows Server 2008 R2 : Windows Media Services - Using Other Windows Media Encoder Options
- Windows Server 2008 R2 : Windows Media Services - Capturing Audio or Video for Future Playback
- BizTalk 2010 Recipes : Adapters - Configuring HTTP Receives
- BizTalk 2010 Recipes : Adapters - Configuring HTTP Sends
- Windows Server 2003 : Securing Network Communications Using IPSec - Troubleshooting Data Transmission Security
- Windows Server 2003 : Securing Network Communications Using IPSec - Deploying IPSec
- Transitioning from Exchange Server 2003 to Exchange Server 2010 (part 3) - Cleaning Up the Exchange Server 2003 and Exchange Server 2003 Environments
- Transitioning from Exchange Server 2003 to Exchange Server 2010 (part 2)
- Transitioning from Exchange Server 2003 to Exchange Server 2010 (part 1)
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server