Share via


BizTalk: Configure WCF-Custom adapter Send Port dynamically

Introduction

More than often we come across situation where we want to configure BizTalk solutions dynamically. WCF-Custom adapter comes in picture when standard WCF adapters do not support any specific requirements. We can configure the adapter in desired manner. It enables the use of WCF extensibility features.

More details of WCF adapters is available here: https://msdn.microsoft.com/en-in/library/bb259952.aspx

Scenario

You want to design send ports dynamically. Through that you want to update some records in Oracle. Action and Operations also needs to be configured dynamically along with the other details such as URI, User Name & Passwords etc.

Problem

Generally we specify below properties to  configure the port dynamically:

msgRequest(WCF.Action)="http://Microsoft.LobServices.OracleDB/2007/03/" + vSQLUserName + "/Table/Events/Update";

msgRequest(WCF.BindingType)="oracleDBBinding";

msgRequest(WCF.UserName)=vSQLUserName;

msgRequest(WCF.Password)=vSQLPassword;

Update_Dynamic_Port(Microsoft.XLANGs.BaseTypes.Address)="oracledb://AppServer/";

Update_Dynamic_Port(Microsoft.XLANGs.BaseTypes.TransportType)="WCF-Custom";

But if we want to set the actions dynamically then these properties are not enough, you may not see the expected results.

Solution

In addition to above mentioned properties, we also need to set some more properties which plays a very important role in the dynamic configuration.

msgRequest(WCF.BindingConfiguration)=@"<binding name=""OracleDBBinding"" closeTimeout=""00:01:00"" openTimeout=""00:01:00"" receiveTimeout=""00:10:00"" sendTimeout=""00:01:00"" metadataPooling=""true"" statementCachePurge=""false"" statementCacheSize=""10"" pollingInterval=""500"" useOracleConnectionPool=""true"" minPoolSize=""1"" maxPoolSize=""1"" incrPoolSize=""5"" decrPoolSize=""1"" connectionLifetime=""0"" acceptCredentialsInUri=""false"" useAmbientTransaction=""true"" polledDataAvailableStatement=""SELECT 1 FROM DUAL"" pollWhileDataFound=""false"" notifyOnListenerStart=""true"" notificationPort=""-1"" inboundOperationType=""Polling"" dataFetchSize=""65536"" longDatatypeColumnSize=""0"" skipNilNodes=""true"" maxOutputAssociativeArrayElements=""32"" enableSafeTyping=""false"" insertBatchSize=""1"" useSchemaInNameSpace=""false"" enableBizTalkCompatibilityMode=""true"" enablePerformanceCounters=""false"" />";

Detailed explanation for each of these properties are given at:

https://msdn.microsoft.com/en-us/library/dd788467.aspx

All of the above properties are optional and have some default values associated. We should change it as per our requirements.

But we should at least use below set below properties, so that .Net framework understand that this bunch of code is intended for BizTalk.

msgRequest(WCF.BindingConfiguration)=@"<binding name=""OracleDBBinding"" enableBizTalkCompatibilityMode=""true"" />"; 

See Also

Read suggested related topics:

Another important place to find a huge amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki