Create SQL Receive Locations Programmatically.

Published on : May 25, 2007

Category : BizTalk Server



One of our recent projects involved creating an orchestration, which was bound to a physical one way receive port polling data from SQL server.  There will be multiple SQL receive locations for the same receive port. The receive locations will have different polling conditions based on the customer. Our requirement was to create one receive location per customer. So, we’ll be adding more SQL receive locations as the customer base increases.  For that reason I created this function (part of a bigger client application) which create SQL receive location programmatically, which uses BizTalk Catalogue explorer object (no WMI). Hope this will be helpful to some one, because there is minor things to take care of.
You can download the .CS file from here.
The below figure shows a SQL receive location created with help of the above function.
How To Execute it: Here is the sample code, which is used to run the function.
string server “SK_WORKSTATION”; string database “ORDER_POLLING”; string address “SQL://” + server + “/” + database + “/” + Guid.NewGuid().ToString();  CreateAndConfigureSQLReceiveLocation( “Receive.SQL.Autogenerated.SK1” “Receive.Sch.Orders.Internal.SQL.1Way.AllPollingService.ActivationMessages” , address , “False” “Minutes” “10” “DocumentRootElement” “” “exec [GetSQLActivationMessage] @AccountNumber=’007′” “Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=ORDER_POLLING;Data Source=SK_WORKSTATION” “Data Source=(local);Initial Catalog=BiztalkMgmtDb;Integrated Security=true;Trusted_Connection=True” );
NOTE: The function assumes you already got a “Receive Port” (which you pass as second argument to the function), but its not hard to create it inside the function. Nandri! Saravana