### Execute BTSXRefImport with Setup File Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/biztalk-server-cross-reference-import-tool-btsxrefimport-exe Example command to run the tool using a specific XML setup file named setupfile.xml. ```text btsxrefimport –file=setupfile.xml ``` -------------------------------- ### BTAJDEOneWorldTrace Usage Examples Source: https://learn.microsoft.com/en-us/biztalk/core/using-event-tracing-for-windows2 Practical examples for starting a real-time transmitter trace and stopping the trace session. ```cmd BTAJDEOneWorldTrace -transmitter -start -cir 10 -rt c:\log\mylog.etl BTAJDEOneWorldTrace -transmitter -stop ``` -------------------------------- ### BTAJDEEnterpriseOneTrace Usage Example Source: https://learn.microsoft.com/en-us/biztalk/core/using-event-tracing-for-windows4 Example commands for starting a transmitter trace in real-time mode and stopping the trace. ```cmd BTAJDEEnterpriseOneTrace -transmitter -start -cir 10 -rt c:\log\mylog.etl BTAJDEEnterpriseOneTrace -transmitter -stop ``` -------------------------------- ### SetConfigInfo Example Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/issoconfigstore-setconfiginfo A placeholder example showing the parameters used with the ConfigStore. ```C# ConfigStore bstrApplication bstrIdentifier ppbConfigInfo ``` -------------------------------- ### Display command line installation options Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/wcf-lob-adapter-sdk/install-the-wcf-lob-adapter-sdk Use this command to view all available installation parameters for the MSI installer. ```shell AdapterFramework.msi /? ``` -------------------------------- ### Execute the Itinerary On-Ramp setup script Source: https://learn.microsoft.com/en-us/biztalk/esb-toolkit/install-the-itinerary-on-ramp-sample-using-the-install-scripts Run this command in a command prompt to initiate the installation, ensuring the path is replaced with the actual location of the .cmd file. ```batch \Setup_bin.cmd ``` -------------------------------- ### SQL Server Connection Examples Source: https://learn.microsoft.com/en-us/biztalk/core/addapp-command Examples of specifying the SQL Server instance for the /Server parameter. ```text Server=MyServer Server=MyServer\MySQLServer,1533 ``` -------------------------------- ### Execute PowerShell Script Example Source: https://learn.microsoft.com/en-us/biztalk/core/applicationmanager-biztalk-server-sample Example command to invoke the PowerShell script for starting a deployed application. ```powershell PS C:\> .\ApplicationManager.ps1 start MyBizTalkApp Issuing start command to MyBizTalkApp ... ``` -------------------------------- ### Map and Install Host Instance via VBScript Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/mapping-and-installing-host-instances-using-wmi Uses MSBTS_ServerHost to map a host to a server and MSBTS_HostInstance to install the instance. Requires appropriate credentials for the Install method. ```VBScript Option Explicit ' Map and install a host instance using MSBTS_ServerHost and MSBTS_HostInstance Sub MapInstallHostInstance (HostName, ServerName, uid, pwd) On Error Resume Next Dim objLocator, objService, objServerHost, objSH Dim objHostInstance, objHI ' Connects to local server WMI Provider BizTalk namespace Set objLocator = Createobject ("wbemScripting.SWbemLocator") Set objService = objLocator.ConnectServer(".", "root/MicrosoftBizTalkServer") ' Step 1 - Create mapping between server and host using MSBTS_ServerHost class Set objServerHost = objService.Get ("MSBTS_ServerHost") Set objSH = objServerHost.SpawnInstance_ objSH.HostName = HostName objSH.ServerName = ServerName ' Invoke MSBTS_ServerHost Map method objSH.Map CheckWMIError wscript.echo "Host - " & HostName & " - has been mapped successfully to server - " & ServerName ' Step 2 - Install the host instance using MSBTS_HostInstance class Set objHostInstance = objService.Get ("MSBTS_HostInstance") Set objHI = objHostInstance.SpawnInstance_ objHI.Name = "Microsoft BizTalk Server " & HostName & " " & ServerName ' Invoke MSBTS_HostInstance Install method objHI.Install uid, pwd, true ' Calling MSBTS_HostInstance::Install(string Logon, string Password, boolean GrantLogOnAsService) method CheckWMIError wscript.echo "HostInstance - " & HostName & " - has been installed successfully on server - " & ServerName end Sub 'This subroutine deals with all errors using the WbemScripting object. Error descriptions 'are returned to the user by printing to the console. Sub CheckWMIError() If Err <> 0 Then On Error Resume Next Dim strErrDesc: strErrDesc = Err.Description Dim ErrNum: ErrNum = Err.Number Dim WMIError : Set WMIError = CreateObject("WbemScripting.SwbemLastError") If ( TypeName(WMIError) = "Empty" ) Then wscript.echo strErrDesc & " (HRESULT: " & Hex(ErrNum) & ")." Else wscript.echo WMIError.Description & "(HRESULT: " & Hex(ErrNum) & ")." Set WMIError = nothing End If wscript.quit 0 End If End Sub ``` -------------------------------- ### BTATIBCORVTrace Execution Example Source: https://learn.microsoft.com/en-us/biztalk/core/troubleshooting-tibco-rendezvous Example commands to start a transmitter trace with a circular log file in real-time mode and subsequently stop the trace. ```text BTATIBCORVTrace -transmitter -start -cir 10 -rt c:\log\mylog.etl BTATIBCORVTrace -transmitter -stop ``` -------------------------------- ### setup-databases Command Examples Source: https://learn.microsoft.com/en-us/biztalk/core/database-commands Basic usage of the setup-databases command with a configuration file, and an example including a notification service user. ```bash bm.exe setup-databases -ConfigFile:BamConfiguration.xml bm.exe setup-databases -ConfigFile:cfg.xml -NSUser:domain\user1 ``` -------------------------------- ### EXEC Statement Examples Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/adapter-siebel/syntax-for-an-exec-statement-in-siebel Examples demonstrating various parameter configurations including named, unnamed, and output parameters. ```text EXEC ExtractDataService.Echo @In, @InOut, @Out OUTPUT EXEC ExtractDataService.Echo 'InputValue', @InOut, @Out OUTPUT EXEC ExtractDataService.Echo @InOut, @Out OUTPUT, @In='InputValue' EXEC ExtractDataService.Echo 'InputValue', @Out OUTPUT, @InOut='InputValue' ``` -------------------------------- ### Test adapter installation and uninstallation Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/wcf-lob-adapter-sdk/create-a-deployment-package-with-the-wcf-lob-adapter-sdk Methods to simulate custom actions for testing adapter installation and uninstallation outside of a formal Setup project. ```csharp /// /// Use this for testing outside of the Setup project /// /// Directory where the adapter assembly is located public static void TestAddConfiguration(string assemblyDirectory) { WCFLOBAdapterInstaller action = new WCFLOBAdapterInstaller(); InstallContext context = new InstallContext(); // In the Setup project, this is set by selecting custom action // and in Properties setting /INSTALLDIR="[TARGETDIR]\" for CustomActionData context.Parameters.Add("INSTALLDIR", assemblyDirectory); action.Context = context; action.AfterInstallEventHandler(null, null); } /// /// Use this for testing outside of the Setup project /// /// Directory where the adapter assembly is located public static void TestRemoveConfiguration(string assemblyDirectory) { WCFLOBAdapterInstaller action = new WCFLOBAdapterInstaller(); InstallContext context = new InstallContext(); // In the Setup project, this is set by selecting custom action // and in Properties setting /INSTALLDIR="[TARGETDIR]\" for CustomActionData context.Parameters.Add("INSTALLDIR", assemblyDirectory); action.Context = context; action.BeforeUninstallEventHandler(null, null); } } } ``` -------------------------------- ### Full Polling Implementation Example Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/adapter-oracle-database/receive-polling-based-data-changed-messages-in-oracle-db-using-a-wcf-channel A complete example demonstrating the configuration and setup of the Oracle Database adapter for polling using the WCF channel model. ```csharp using System; using System.Collections.Generic; using System.Text; // Add WCF, WCF LOB Adapter SDK, and Oracle Database adapter namepaces using System.ServiceModel; using System.ServiceModel.Description; using Microsoft.ServiceModel.Channels; using Microsoft.Adapters.OracleDB; // Add this namespace for channel model using System.ServiceModel.Channels; using System.Xml; using System.Runtime.Serialization; using System.IO; // Include this namespace for the WCF LOB Adapter SDK and Oracle exceptions using Microsoft.ServiceModel.Channels.Common; namespace OraclePollingCM { class Program { static void Main(string[] args) { Uri connectionUri = new Uri("oracleDB://ADAPTER/"); IChannelListener listener = null; IInputChannel channel = null; // set timeout to receive POLLINGSTMT message TimeSpan messageTimeout = new TimeSpan(0, 0, 30); ``` -------------------------------- ### BTAPeopleSoftTrace Usage Example Source: https://learn.microsoft.com/en-us/biztalk/core/using-event-tracing-for-windows5 Example commands for starting a real-time transmitter trace with a circular log file and stopping the trace. ```cmd BTAPeopleSoftTrace -transmitter -start -cir 10 -rt C:\log\mylog.etl BTAPeopleSoftTrace -transmitter -stop ``` -------------------------------- ### BTATIBCOEMSTrace Usage Example Source: https://learn.microsoft.com/en-us/biztalk/core/using-event-tracing-for-windows3 Example commands to start a real-time circular trace for the transmitter provider and subsequently stop it. ```cmd BTATIBCOEMSTrace -transmitter -start -cir 10 -rt c:\log\mylog.etl BTATIBCOEMSTrace -transmitter -stop ``` -------------------------------- ### Full tRFC Client Example Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/adapter-sap/invoke-trfcs-in-sap-using-the-wcf-service-model A complete example demonstrating the setup and structure for invoking BAPI_SALESORDER_CREATE as a tRFC. ```csharp using System; using System.Collections.Generic; using System.Text; // Add WCF, the WCF LOB Adapter SDK, and SAP adapter namepaces using System.ServiceModel; using Microsoft.Adapters.SAP; using Microsoft.ServiceModel.Channels; // Include this namespace for WCF LOB Adapter SDK and SAP exceptions using Microsoft.ServiceModel.Channels.Common; using microsoft.lobservices.sap._2007._03.Types.Rfc; // This example demonstrates sending BAPI_SALESORDER_CREATEFROMDAT2 as a tRFC. The client has // methods to: // send the BAPI (BAPI_SALESORDER_CREATEFROMDAT2)and to // Confirm the transaction (RfcConfirmTransID) // An instance of BAPI_SALESORDER_CREATEFROMDAT2Request (generated) // is used to format the BAPI before invoking BAPI_SALESORDER_CREATEFROMDAT2. This // is not necessary, but is done to make it easier to read the code. // tRFC invocations always includes a ref parameter that contains a GUID. You can optionally // set this parameter when you invoke the method; however, you must use the value returned by // the adapter when you call RfcConfirmTransID to confirm the transaction on the SAP system. // You can call the utility method, SAPAdapterUtilities.ConvertGuidToTid, to get the value // of the SAP transaction Id from the GUID that the adapter returns. namespace SapTrfcClientSM { class Program { static void Main(string[] args) { TrfcClient sapTrfcClient = null; try { Console.WriteLine("SAP TRFC client sample started"); Console.WriteLine("Creating the TRFC client"); ``` -------------------------------- ### Server Parameter Examples Source: https://learn.microsoft.com/en-us/biztalk/core/addresource-command-virtual-directory Examples of specifying the SQL Server instance for the BizTalk Management database. ```text Server=MyServer ``` ```text Server=MyServer\MySQLServer,1533 ``` -------------------------------- ### Install Method Declaration Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/msbts-hostinstance-install-method The method signature for installing a BizTalk host instance service. ```C# uint32 Install(string Logon, string Password, boolean GrantLogOnAsService, boolean IsGmsaAccount); ``` -------------------------------- ### DeleteConfigInfo C# Example Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/issoconfigstore-deleteconfiginfo A placeholder example showing the parameters used with the ConfigStore interface. ```csharp ConfigStore bstrApplication bstrIdentifier ``` -------------------------------- ### Source Parameter Example Source: https://learn.microsoft.com/en-us/biztalk/core/addresource-command-virtual-directory Example format for the Source parameter URI. ```text http://MyHost:80/MyPath/MyVirtualDirectory ``` -------------------------------- ### Start Method Declaration Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/msbts-host-start-method-wmi The method signature for starting BizTalk Host instances. ```C# uint32 StartService(); ``` -------------------------------- ### Start Method Syntax Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/msbts-sendport-start-method-wmi The method signature for starting a send port, defined in a language-neutral format. ```C# uint32 Start(); ``` -------------------------------- ### GetConfigInfo C# Example Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/issoconfigstore-getconfiginfo Placeholder example structure for the GetConfigInfo method in C#. ```csharp ConfigStore bstrApplication bstrIdentifier lFlags ppbConfigInfo ``` -------------------------------- ### Execute Transformation Service Installation Script Source: https://learn.microsoft.com/en-us/biztalk/esb-toolkit/install-the-transformation-service-sample-using-the-install-scripts Run this command in the command prompt to initiate the installation, ensuring the path is replaced with the correct directory location. ```batch \TransformServices_Install.cmd ``` -------------------------------- ### ImportApp Command Example Source: https://learn.microsoft.com/en-us/biztalk/core/importapp-command Example command to import an .msi package into a specific application with environment settings and overwrite enabled. ```text BTSTask ImportApp /Package:C:\MSI\MyApplication.msi /Environment:Test /ApplicationName:MyApplication /Overwrite ``` -------------------------------- ### Implement a custom installer for WCF LOB adapter registration Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/wcf-lob-adapter-sdk/create-a-deployment-package-with-the-wcf-lob-adapter-sdk This C# class uses the Installer base class to handle adapter registration in the machine.config file during installation. ```csharp using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration.Install; using System.Reflection; using System.ServiceModel.Configuration; using System.Diagnostics; using System.Configuration; namespace Microsoft.Adapters.Samples.EchoV2 { //Custom action to register the adapter with WCF configuration in machine.config // // // // // // // // // // // // // [RunInstaller(true)] public partial class WCFLOBAdapterInstaller : Installer { private Assembly adapterAssembly; private Type bindingSectionType; private Type bindingElementExtensionType; const string INSTALLER_PARM_INSTALLDIR = "INSTALLDIR"; const string BINDING_ASSEMBLY_NAME = "Microsoft.Adapters.Samples.EchoV2.EchoAdapter.dll"; const string BINDINGELEM_NAME = "echoAdapterV2"; const string BINDINGELEM_TYPE = "Microsoft.Adapters.Samples.EchoV2.EchoAdapterBindingElementExtensionElement"; const string BINDING_NAME = "echoAdapterBindingV2"; const string BINDING_TYPE = "Microsoft.Adapters.Samples.EchoV2.EchoAdapterBindingCollectionElement"; const string BINDING_SCHEME = "echov2"; /// /// Constructor - initialize the components and register the event handlers /// public WCFLOBAdapterInstaller() { InitializeComponent(); this.AfterInstall += new InstallEventHandler(AfterInstallEventHandler); this.BeforeUninstall += new InstallEventHandler(BeforeUninstallEventHandler); } /// /// Add the WCF configuration information in machine.config when installing the adapter. /// /// /// private void AfterInstallEventHandler(object sender, InstallEventArgs e) { try ``` -------------------------------- ### SAP Connection String Examples Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/adapter-sap/read-about-data-provider-types-for-the-sap-connection-string Examples of connection strings for different SAP connection types. ```text TYPE=A; ASHOST=SAPSERVER; SYSNR=00; CLIENT=800; LANG=EN; USER=YourUserName; PASSWD=YourPassword; ``` ```text TYPE=B; R3NAME=NAME1; GROUP=ADAPTER; MSHOST=MSSERVER; CLIENT=800; LANG=EN; USER=YourUserName; PASSWD=YourPassword; ``` ```text TYPE=D; DEST=TESTSAPSRV; CLIENT=800; LANG=EN; USER=YourUserName; PASSWD=YourPassword; ``` -------------------------------- ### Echo Adapter URI Examples Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/wcf-lob-adapter-sdk/step-3-implement-the-connection-for-the-echo-adapter Examples of connection URIs used to configure adapter features. ```text echo2://lobhostname/lobapplication?enableAuthentication=[true|false] ``` ```text echo2://lobhostname/lobapplication?enableAuthentication=[true|false]&echoInUpperCase=true ``` -------------------------------- ### Enumerate and Start Host Instances in C# Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/enumerating-and-starting-all-host-instances-using-wmi Uses System.Management to query the root\MicrosoftBizTalkServer namespace and invoke the Start method on stopped instances. ```csharp using System.Management; //Function to Enumerate all HostInstances of "InProcess" type and start them public void EnumerateAndStart() { try { //Create EnumerationOptions and run wql query EnumerationOptions enumOptions = new EnumerationOptions(); enumOptions.ReturnImmediately = false; //Search for all HostInstances of 'InProcess' type in the Biztalk namespace scope ManagementObjectSearcher searchObject = new ManagementObjectSearcher("root\\MicrosoftBizTalkServer","Select * from MSBTS_HostInstance where HostType=1",enumOptions); //Enumerate through the result set and start each HostInstance if it is already stopped foreach(ManagementObject inst in searchObject.Get()) { //Check if ServiceState is 'Stopped' if(inst["ServiceState"].ToString() == "1") { inst.InvokeMethod("Start",null); } Console.WriteLine("HostInstance of Host: " + inst["HostName"] + " and Server: " + inst["RunningServer"] + " was started successfully"); } Console.WriteLine("All HostInstances started"); return; } catch(Exception excep) { Console.WriteLine("Failure while starting HostInstances - " + excep.Message); } } ``` -------------------------------- ### Start Method Syntax Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/msbts-orchestration-start-method-wmi Defines the signature for the Start method, which accepts three integer flags to control the orchestration startup behavior. ```C# uint32 Start( uint32 AutoEnableReceiveLocationFlag, uint32 AutoResumeOrchestrationInstanceFlag, uint32 AutoStartSendPortsFlag ); ``` -------------------------------- ### HTTP GET Request with LocationID Source: https://learn.microsoft.com/en-us/biztalk/core/http-receive-adapter Example of an HTTP GET request targeting a specific location ID. ```http http://servername/vroot/BTSHTTPReceive.dll?LocationID=1 ``` -------------------------------- ### Connection URI example Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/adapter-oracle-ebs/configure-the-oracle-client-for-the-e-business-suite-adapter Example of specifying the configured net service name within a connection URI. ```text oracleebs://ADAPTER ``` -------------------------------- ### Run Enlist Orchestration Sample Source: https://learn.microsoft.com/en-us/biztalk/core/enlist-orchestration-biztalk-server-sample Command-line examples for executing the VBScript and C# versions of the orchestration enlistment tool. ```bash cscript EnlistOrch.vbs MyBusinessOrchestration "My Business Assembly" ``` ```bash EnlistOrc MyBusinessOrchestration "My Business Assembly" ``` -------------------------------- ### HTTP GET Request with Multiple Parameters Source: https://learn.microsoft.com/en-us/biztalk/core/http-receive-adapter Example of an HTTP GET request containing multiple query parameters. ```http http://servername/vroot/BTSHTTPReceive.dll?LocationID=1&MyParam=My%20Value ``` -------------------------------- ### SetupComplete.cmd Script Source: https://learn.microsoft.com/en-us/biztalk/core/sysprep-a-biztalk-server-vhd-biztalk-server-sample This script handles post-Sysprep cleanup and SQL Server login updates. It should be placed in the C:\Windows\Setup\Scripts\ folder. ```batch del /Q /F c:\windows\system32\sysprep\sysprep.xml SqlCmd -s . -d Repository -A -Q "drop login [PDC08-CSD\Administrator]" SqlCmd -s . -d Repository -A -Q "create login [$(COMPUTERNAME)\Administrator] from windows" SqlCmd -s . -d Repository -A -Q "EXEC sp_changedbowner [$(COMPUTERNAME)\Administrator]" ``` -------------------------------- ### Set up BAM databases via command line Source: https://learn.microsoft.com/en-us/biztalk/core/how-to-set-up-the-bam-databases-using-the-bam-management-utility Execute the setup-databases command using the BAM Management utility with a specified configuration file. ```cmd bm setup-databases -ConfigFile: ``` -------------------------------- ### HTTP GET Request without Parameters Source: https://learn.microsoft.com/en-us/biztalk/core/http-receive-adapter Example of an HTTP GET request that results in a rejection due to missing parameters. ```http http://servername/vroot/BTSHTTPReceive.dll ``` -------------------------------- ### BAM Configuration XML Example Source: https://learn.microsoft.com/en-us/biztalk/core/modifying-the-bam-configuration-schema A sample configuration file demonstrating the structure for deployment units and properties. ```xml . BAMPrimaryImport 60 5 . BAMStarSchema localhost BAMAnalysis . BAMArchiving 15 1 myOwnerPassword myUserPassword 15 1 myOwnerPassword myUserPassword ``` -------------------------------- ### ListApps Command Sample Source: https://learn.microsoft.com/en-us/biztalk/core/listapps-command A simple example of running the ListApps command without optional parameters. ```text BTSTask ListApps ``` -------------------------------- ### Enable Home Organization with Loopback Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/accelerator-rosettanet/step-5-create-a-mirror-agreement Run this command in the SDK directory to enable the home organization before mirroring agreements. ```cmd Loopback /enable HOME ``` -------------------------------- ### Sample get-changes Output Source: https://learn.microsoft.com/en-us/biztalk/core/infrastructure-management-commands Example output showing the command type, user, timestamp, and affected activities or views. ```text #1: Deploy c:\bam\ordermanagement.xml By domain\user at 12/30/2005 8:17:08 PM (v3.5.1536.0). Activities: OrderMgmt Views: SalesManager ``` -------------------------------- ### Get Subscription Command Examples Source: https://learn.microsoft.com/en-us/biztalk/core/alert-subscription-management-commands Retrieves a list of subscribers for a specified alert using the bm.exe utility. ```bash bm.exe get-subscriptions -View:SalesManagerView -Alert:SalesTooLow bm.exe get-subscriptions -View:Shipments -Alert:SlowShipment -Server:Ship1 ``` -------------------------------- ### Map and Install Host Instance using WMI Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/mapping-and-installing-host-instances-using-wmi Uses the System.Management namespace to interact with MSBTS_ServerHost and MSBTS_HostInstance classes. Requires valid credentials for the installation process. ```csharp using System.Management; //Function to Map and Install a HostInstance using MSBTS_ServerHost and MSBTS_HostInstance public void MapAndInstall(string hostName, string svrName, string uid, string pwd) { try { //Build the name of the HostInstance - name has to be in the below format string hostInstanceName = "Microsoft BizTalk Server" //Name of product + " " + hostName //Name of Host of which instance is to be created + " " + svrName; //Name of Server on which instance is to be created //Create an instance of the ServerHost class using the System.Management namespace ObjectGetOptions svrHostOptions = new ObjectGetOptions(); ManagementClass svrHostClass = new ManagementClass("root\\MicrosoftBizTalkServer","MSBTS_ServerHost",svrHostOptions); ManagementObject svrHostObject = svrHostClass.CreateInstance(); //Set the properties of the ServerHost instance svrHostObject["ServerName"] = svrName; svrHostObject["HostName"] = hostName; //Invoke the Map method of the ServerHost instance svrHostObject.InvokeMethod("Map",null); //Create an instance of the HostInstance class using the System.Management namespace ObjectGetOptions hostInstOptions = new ObjectGetOptions(); ManagementClass hostInstClass = new ManagementClass("root\\MicrosoftBizTalkServer","MSBTS_HostInstance",hostInstOptions); ManagementObject hostInstObject = hostInstClass.CreateInstance(); //Set the properties of the HostInstance class hostInstObject["Name"] = hostInstanceName; //Build a parameter array object [] args = new object[2]; args[0] = uid; args[1] = pwd; //Invoke the Install method of the HostInstance hostInstObject.InvokeMethod("Install",args); Console.WriteLine("HostInstance was mapped and installed successfully. Mapping created between Host: " + hostName + " and Server: " + svrName); return; } catch(Exception excep) { Console.WriteLine("Failure during HostInstance creation: " + excep.Message); } } ``` -------------------------------- ### Bounded Loop Segment Structure Source: https://learn.microsoft.com/en-us/biztalk/core/edi-segment-structural-element Example demonstrating how a segment can be used both to start a bounded loop and appear outside of it. ```text AA LS BB CC LE BB ``` -------------------------------- ### SampleUpdateInfo.xml configuration for partial database migration Source: https://learn.microsoft.com/en-us/biztalk/technical-guides/before-you-move-the-tracking-database-if-messagebox-database-is-not-moving Example configuration showing the Tracking database moving to a new server while the MessageBox database remains on the original server. ```xml ``` -------------------------------- ### ADDLOCAL Command Values for BizTalk Server 2020 Source: https://learn.microsoft.com/en-us/biztalk/install-and-config-guides/appendix-a-silent-installation Use these values with the /ADDLOCAL command-line parameter to specify which features to install during a silent setup. ```text /ADDLOCAL ALL ``` ```text /ADDLOCAL InfoWorkerApps,WMI,BizTalk ``` ```text /ADDLOCAL InfoWorkerApps,BAMPortal,WMI,BizTalk ``` ```text /ADDLOCAL MsEDISchemaExtension,MsEDISDK,MsEDIMigration,SDK,WMI,BizTalk,Migration,Development,BizTalkExplorer,BizTalkExtensions,OrchestrationDesigner,Designer,PipelineDesigner,XMLTools,AdapterImportWizard,VSTools,WCFDevTools,DeploymentWizard,TrackingProfileEditor ``` ```text /ADDLOCAL WMI,BizTalk,WCFSQLAdapter,Engine,MOT,MSMQ,Runtime ``` ```text /ADDLOCAL MsEDIAS2,MsEDIAS2StatusReporting,WMI,BizTalk,WCFSQLAdapter,Engine,MOT,MSMQ,Runtime ``` ```text /ADDLOCAL WCFLOBAdapters,WMI,BizTalk,WCFSQLAdapter,Engine,MOT,MSMQ,Runtime,WCFSAPAdapter,WCFOracleDBAdapter,WCFOracleEBSAdapter,WCFSiebelAdapter,WCFAdapter ``` ```text /ADDLOCAL PAM,WMI,BizTalk,AdminAndMonitoring,MonitoringAndTracking,AdminTools,BizTalkAdminSnapIn,HealthActivityClient,BAMTools ``` ```text /ADDLOCAL PAM,WMI,BizTalk,WcfAdapterAdminTools,AdminAndMonitoring,MonitoringAndTracking,AdminTools,BizTalkAdminSnapIn,HealthActivityClient,BAMTools ``` ```text /ADDLOCAL WMI,BizTalk,SSOAdmin,AdditionalApps ``` ```text /ADDLOCAL WMI,BizTalk,AdditionalApps,SSOServer ``` ```text /ADDLOCAL WMI,BizTalk,AdditionalApps,RulesEngine ``` ```text /ADDLOCAL WMI,BizTalk,AdditionalApps,MQSeriesAgent ``` ```text /ADDLOCAL WMI,BizTalk,AdditionalApps,OLAPNS ``` ```text /ADDLOCAL WMI,BizTalk,AdditionalApps,FBAMCLIENT ``` ```text /ADDLOCAL WMI,BizTalk,AdditionalApps,BAMEVENTAPI ``` ```text /ADDLOCAL WMI,BizTalk,AdditionalApps,ProjectBuildComponent ``` ```text /ADDLOCAL WMI,BizTalk,AdditionalApps,BizTalkTMS ``` -------------------------------- ### BTSTask AddResource Sample Source: https://learn.microsoft.com/en-us/biztalk/core/addresource-command-postprocessing-script Example command demonstrating how to add a postprocessing script with specific application, source, destination, and argument parameters. ```text BTSTask AddResource /ApplicationName:MyApplication /Type: System.BizTalk:PostProcessingScript /Overwrite /Source:"C:\Source Scripts\MyScript.vbs" /Destination:"C:\New Scripts\MyScript.vbs" /Server:MyDatabaseServer /Database:BizTalkMgmtDb /Property:Args="argument1 argument2" ``` -------------------------------- ### Implement WCF Service for Oracle EBS Notifications Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/adapter-oracle-ebs/receive-oracle-ebs-database-change-notifications-using-the-wcf-service-model This example demonstrates the full implementation of a WCF service class, custom credentials, and the host setup required to receive notifications. ```csharp using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Adapters.OracleEBS; using Microsoft.ServiceModel.Channels; using System.ServiceModel; using System.ServiceModel.Description; using System.ServiceModel.Channels; using System.Collections.ObjectModel; namespace Notification_ServiceModel { [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] public class NotificationService : OracleEBSBindingNamespace.OracleEBSBindingService { public override void Notification(Notification request) { Console.WriteLine("\nNew Notification Received"); Console.WriteLine("*************************************************"); Console.WriteLine(request.Info); Console.WriteLine(request.Source); Console.WriteLine(request.Type); Console.WriteLine("*************************************************"); TableOperation Ops = new TableOperation(); Ops.TableOp(); } } class NotificationCredentials : ClientCredentials, IServiceBehavior { public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection endpoints, BindingParameterCollection bindingParameters) { bindingParameters.Add(this); } public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { } public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { } protected override ClientCredentials CloneCore() { ClientCredentials clone = new NotificationCredentials(); clone.UserName.UserName = this.UserName.UserName; clone.UserName.Password = this.UserName.Password; return clone; } } class Program { static void Main(string[] args) { ServiceHost serviceHost = null; try { Console.WriteLine("Sample started..."); Console.WriteLine("Press any key to start receiving notifications..."); Console.ReadLine(); OracleEBSBinding binding = new OracleEBSBinding(); binding.InboundOperationType = InboundOperation.Notification; binding.NotificationStatement = "SELECT TID,ACCOUNT,PROCESSED FROM APPS.ACCOUNTACTIVITY WHERE PROCESSED = 'n'"; binding.NotifyOnListenerStart = true; binding.NotificationPort = 10; // This URI is used to specify the address for the ServiceEndpoint // It must contain the InboundId that was used to generate // the WCF service callback interface Uri ConnectionUri = new Uri("oracleebs://ebs_instance_name"); // This URI is used to initialize the ServiceHost. It cannot contain // an InboundID; otherwise,an exception is thrown when // the ServiceHost is initialized. Uri[] baseUri = new Uri[] { new Uri("oracleebs://ebs_instance_name") }; NotificationCredentials credentials = new NotificationCredentials(); credentials.UserName.UserName = ""; credentials.UserName.Password = ""; Console.WriteLine("Opening service host..."); NotificationService service = new NotificationService(); serviceHost = new ServiceHost(service, baseUri); serviceHost.Description.Behaviors.Add(credentials); serviceHost.AddServiceEndpoint("Notification_", binding, ConnectionUri); serviceHost.Open(); Console.WriteLine("Service host opened..."); Console.WriteLine("Waiting for notification..."); Console.WriteLine("\nHit to stop receiving notification"); Console.ReadLine(); } catch (Exception e) { Console.WriteLine("Exception :" + e.Message); Console.ReadLine(); /* If there is an error it will be specified in the inner exception */ if (e.InnerException != null) { Console.WriteLine("InnerException: " + e.InnerException.Message); Console.ReadLine(); } } finally { // IMPORTANT: you must close the ServiceHost to stop polling if (serviceHost.State == CommunicationState.Opened) serviceHost.Close(); else serviceHost.Abort(); } } } } ``` -------------------------------- ### Browse Metadata Nodes in Oracle Database Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/adapter-oracle-database/get-metadata-in-oracle-database-using-imetadataretrievalcontract Use the Browse method to retrieve metadata nodes contained within a parent node. This example retrieves the first three schemas starting from the root node. ```csharp // The first parameter is the node ID. // The second parameter is the start index. // The third parameter is the maximum number of nodes to return. MetadataRetrievalNode[] nodes = client.Browse(MetadataRetrievalNode.Root.NodeId, 0, 3); ``` -------------------------------- ### Initialize Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/ibttransmitter-methods-com Initializes the adapter. ```APIDOC ## Initialize ### Description Initializes the adapter. ``` -------------------------------- ### ListApp Command Sample Source: https://learn.microsoft.com/en-us/biztalk/core/listapp-command Example command to list artifacts for a specific application and export the results to an XML file. ```text BTSTask ListApp /ApplicationName:MyApplication /ResourceSpec:C:\Artifacts\MyArtifacts.xml ``` -------------------------------- ### Trigger installer rollback in Batch Source: https://learn.microsoft.com/en-us/biztalk/core/creating-a-pre-or-post-processing-script Use exit /b 1 to signal an error to Windows Installer, triggering a rollback of the installation. ```batch set LogFile=C:\ScriptLog.txt set PublicKeyToken=e5fd0ea4ecd37420 if not defined PublicKeyToken ( echo %DATE% %TIME% Public key should be set in script >> %LogFile% exit /b 1 ``` -------------------------------- ### Example Resolver Connection Strings Source: https://learn.microsoft.com/en-us/biztalk/esb-toolkit/executing-an-itinerary-service Sample connection strings demonstrating various resolver types supported by the Resolver and Adapter Framework. ```idl BRE:\\policy=GetCanadaPurchaseEndPoint;version=;useMsg=; UDDI:\\serverUrl=http://localhost/uddi;serviceName=OrderFileServiceWBindings; STATIC:\\TransportLocation=http://localhost/ESB.CanadianServices/SubmitPOService.asmx; TargetNamespace=http://globalbank.esb.dynamicresolution.com/canadianservices/; XPATH:\\TransportType=; TransportLocation=/*[local-name()='OrderDoc' and namespace- uri()='http://globalbank.esb.dynamicresolution.com/northamericanservices/']/* [local-name()='ID' and namespace- uri()='http://globalbank.esb.dynamicresolution.com/northamericanservices/']; TargetNamespace=/*[local-name()='OrderDoc' and namespace- uri()='http://globalbank.esb.dynamicresolution.com/northamericanservices/']/* [local-name()='customerName' and namespace- uri()='http://globalbank.esb.dynamicresolution.com/northamericanservices/']; ``` -------------------------------- ### BeginDoc XML Sample Source: https://learn.microsoft.com/en-us/biztalk/core/xml-for-a-salesorder-session Initializes a SalesOrder session using the F4211FSBeginDoc schema. ```xml A 1 BVISION02 2 XMLInterop ZJDE0001 SO M30 1001 Y 0 1 0 ``` -------------------------------- ### EncryptionCert Example Value Source: https://learn.microsoft.com/en-us/biztalk/core/technical-reference/msbts-receivelocation-encryptioncert-wmi An example of a properly formatted certificate string. ```C# "E=lab, C=US, S=Wa, L=Redmond, O=Microsoft, OU=BizTalk, CN=EncryptSample" ``` -------------------------------- ### Deploy a Tracking Profile via Command Line Source: https://learn.microsoft.com/en-us/biztalk/core/how-to-deploy-tracking-profiles-with-the-tracking-profiles-management-utility Execute the deployment utility from the installation directory to apply a specific .btt tracking profile. ```shell bttdeploy.exe .btt ``` -------------------------------- ### StartListener Implementation Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/wcf-lob-adapter-sdk/step-8-implement-the-synchronous-inbound-handler-for-the-echo-adapter Logic to verify parameters and start monitoring for file activity. ```csharp // if no actions are provided, log an error in the trace log // and throw an exception if (actions.Length == 0) { EchoAdapterUtilities.Trace.Trace(TraceEventType.Error, "http://echoadapterv2/startlistener/noactions", "No operation actions were received for listener to do specific processing.", this); throw new AdapterException("Unable to receive any actions for inbound handler to start listening."); } inboundQueue = new Queue(); foreach (string action in actions) { // for the OnReceiveEcho action listen for a new file created event if ("Echo/OnReceiveEcho".Equals(action)) { if (inboundWatcher == null) { inboundWatcher = new FileSystemWatcher(path); inboundWatcher.Filter = filter; // Begin monitoring inboundWatcher.EnableRaisingEvents = true; } inboundWatcher.Created += new FileSystemEventHandler(FileMonitor_Created); EchoAdapterUtilities.Trace.Trace(TraceEventType.Information, "http://echoadapterv2/startlistener", "Listening for file created event for " + filter + " in path " + path, this); } } ``` -------------------------------- ### AddApp Command Sample Source: https://learn.microsoft.com/en-us/biztalk/core/addapp-command A basic example of creating a new BizTalk application with a specified name and description. ```text AddApp /ApplicationName:MyApplication /Description:"My BizTalk application" ``` -------------------------------- ### Install BizTalk Application via Command Line Source: https://learn.microsoft.com/en-us/biztalk/core/how-to-install-a-biztalk-application Use the msiexec command to install a BizTalk application package. The TARGETDIR parameter specifies the installation directory and sets the %BTAD_InstallDir% environment variable. ```bash msiexec /i MyApplication.msi ``` ```bash TARGETDIR="C:\Programs\BizTalk Applications\My Application" ``` -------------------------------- ### Configure Pipeline.exe command line arguments Source: https://learn.microsoft.com/en-us/biztalk/core/debugging-custom-pipelines Example command line configuration for testing a pipeline and sample file using Pipeline.exe. ```text \YourPipeline.btp -d \YourTestFile.txt -c ``` -------------------------------- ### Implement and Host an RFC Server Application Source: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/adapter-sap/receive-inbound-rfc-calls-in-sap-using-the-wcf-service-model This example shows the implementation of a WCF service class to handle RFC requests and the main program logic to host the service using the SAP adapter. ```csharp using System; using System.Collections.Generic; using System.Text; // Add WCF, WCF LOB Adapter SDK, and SAP adapter namepaces using System.ServiceModel; using Microsoft.Adapters.SAP; using Microsoft.ServiceModel.Channels; // Include this namespace for the WCF LOB Adapter SDK and SAP adapter exceptions using Microsoft.ServiceModel.Channels.Common; namespace SapRfcServerSM { // Implement a WCF service callback class by sub-classing the generated service callback class (SAPBindingService). // You must annotate this class with the InstanceContextMode.Single ServiceBehavior // If you implement your code in SAPBindingService.cs be sure to annotate the SAPBindingService class // The callback method should return a Z_RFC_MKD_ADDResponse to indicate successful processing // or throw an exception to indicate an error. [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,UseSynchronizationContext = false)] class RfcServerClass : SAPBindingNamespace.SAPBindingService { public override Z_RFC_MKD_ADDResponse Z_RFC_MKD_ADD(Z_RFC_MKD_ADDRequest request) { // If either parameter is null, throw an exception if (request.X == null || request.Y == null) throw new System.ArgumentNullException(); int result = (int) (request.X + request.Y); Console.WriteLine("\nRfc Received"); Console.WriteLine("X =\t\t" + request.X.ToString()); Console.WriteLine("Y =\t\t" + request.Y.ToString()); Console.WriteLine("Result =\t" + result); Console.WriteLine("\nHit to end"); return new Z_RFC_MKD_ADDResponse(result); } } class Program { static void Main(string[] args) { // Listener connection for the service URI -- the connection URI must contain credentials Uri serviceUri = new Uri("sap://User=YourUserName;Passwd=YourPassword;Client=800;Lang=EN;@a/ADAPSAP47/00?ListenerGwServ=SAPGW00&ListenerGwHost=ADAPSAP47&ListenerProgramId=ADDER"); // The baseUri cannot contain userinfoparams or query_string parameters Uri[] baseUri = new Uri[] { new Uri("sap://a/ADAPSAP47/00") }; Console.WriteLine("RFC server sample started"); // create service instance RfcServerClass rfcServerInstance = new RfcServerClass(); try { Console.WriteLine("Initializing service host -- please wait"); // Create and initialize a service host using (ServiceHost srvHost = new ServiceHost(rfcServerInstance, baseUri)) { // Add service endpoint // Specify AcceptCredentalsInUri=true for the binding // NOTE: The contract for the service endpoint is "Rfc". // This is the generated WCF service callback interface (see SAPBindingInterface.cs). SAPBinding binding = new SAPBinding(); binding.AcceptCredentialsInUri = true; srvHost.AddServiceEndpoint("Rfc", binding, serviceUri); srvHost.Open(); Console.WriteLine("\nReady to receive Z_RFC_MKD_ADD RFC"); Console.WriteLine("Hit to end"); // Wait to receive request Console.ReadLine(); } } catch (ConnectionException cex) { Console.WriteLine("Exception occurred connecting to the SAP system"); Console.WriteLine(cex.InnerException.Message); } catch (TargetSystemException tex) { Console.WriteLine("Exception occurred on the SAP system"); Console.WriteLine(tex.InnerException.Message); } catch (Exception ex) { Console.WriteLine("Exception is: " + ex.Message); if (ex.InnerException != null) { Console.WriteLine("Inner Exception is: " + ex.InnerException.Message); } } } } } ``` -------------------------------- ### Invoice Interchange Example Source: https://learn.microsoft.com/en-us/biztalk/core/composed-message-processor-biztalk-server-sample Example of the target flat file format for invoice interchanges. ```text Northwest Shipping DocumentTypes:Invoices INVOICE1999-10-20 BILLTO,US,Alice Smith,123 Maple Street,Mill Valley,CA,90952 872-AA Lawnmower 1 148.95 Confirm this is electric 926-AA Baby Monitor 1 39.98 Confirm this is electric INVOICE1999-10-21 BILLTO,US,John Dow,123 Elm Street,Mill Valley,CA,90952 398-BB Tire 4 324.99 Wrap them up nicely 201-BB Engine Oil 1 12.99 SAE10W30 INVOICE1999-10-20 BILLTO,US,John Connor,123 Cedar Street,Mill Valley,CA,90952 101-TT Plastic flowers 10 4.99 Fragile handle with care 202-RR Fertilizer 1 10.99 Lawn fertilizer 453-XS Weed killer 1 5.99 Lawn weed killer ``` -------------------------------- ### Create Affiliate Application via Command Line Source: https://learn.microsoft.com/en-us/biztalk/core/creating-affiliate-applications2 Executes the ssomanage utility to register an affiliate application from an XML configuration file. ```bash ssomanage.exe -createapps C:\SSOtest\AffiliateApplication.xml ``` -------------------------------- ### Correlation Expression Example Source: https://learn.microsoft.com/en-us/biztalk/core/autogeneratecorrelationtoken An example of using AutoGenerateCorrelationToken within an ic:CorrelationID expression. ```xml ```