ESB Guidance...part 5

Listen with webReader
Published 25 January 08 12:03 AM | wmmihaa
Extending ESB Guidance

·         Blogical.Adapter.SQL - Download

·         Blogical.Adapter.SMTP - Download

·         Blogical.Resolver.LDAP - Download

·         Blogical.Resolver.SQL - Download

Adapter Provider Framework
After a resolver executes, the dynamic resolution service checks whether the result is an endpoint (not a transformation). If it is an endpoint, the service instantiates the adapter manager, which validates and fixes the transport type and the outbound transport location.
The adapter manager uses the suffix stated in the transport location (eg FTP://) to determine the appropriate adapter provider. An adapter provider is a custom assembly that must implement the IAdapterProvider interface. The adapter provider uses the properties of the Resolution structure within the Dictionary instance generated by the resolver to set all the protocol-specific properties of the message that enable the BizTalk run-time engine to perform dynamic resolution.

The Resolver Framework

The itinerary describes a composition of services to be executed, such as transformation, routing and dynamic end-point resolution. Each of which works with a set of resolvers, that will provide the necessary input for that service or endpoint. Which resolver to be used is described by a moniker Eg UDDI://.
A resolver takes the resolver connection string, validates it, and uses the result to query and populate a Dictionary object that Adapter Providers and Services can use.


SQL Adapter provider

The integrated SQL adapter, which ships with BizTalk Server, is designed for sharing data between BizTalk Server and Microsoft SQL Server databases. The Blogical.Adapter.SQL adapter provider reads the Resolver.EndpointConfig property from the chosen resolver and sets the necessary context properties for SQL adapter.

Resolver configuration sample:

<Resolvers serviceId="DynamicTest0">
&lt;![CDATA[STATIC:\\TransportLocation=SQL://;EndpointConfig=
IntegratedSecurity=SSPI&amp;
PersistSecurityInfo=False&amp;
InitialCatalog=EsbAdmin&amp;
DataSource=localhost&amp;
DocumentTargetNameSpace=http://SQLSendProject1=&amp;
ResponseDocumentRootElementName=PersonResponse;]]&gt;</Resolvers>

 

Machine.Config settings:

<add key="SQL"
         value="Blogical.Adapter.SQL,
         Version=1.0.0.0, Culture=neutral,
         PublicKeyToken=c2c8b2b87f54180a" />

 

Supported Resolvers: STATIC, BRE

 

SMTP Adapter provider
BizTalk Server can send messages to other applications by creating an e-mail message and delivering it to a specified e-mail address. One often mentioned problem, when using the SMTP adapter, is that the To address property makes up the actual send port uri and is there for not be dynamically set if you’d like to send (route) different messages to different users. This issue can be solved by using a dynamic send port and set the SMTP properties at runtime.  The Blogical.Adapter.SMTP adapter takes on the very same approach and reads the Resolver.TransportLocation and the Resolver.EndPointConfig from the chosen resolver and sets the necessary context properties.

 

Resolver configuration sample:

<Resolvers serviceId="DynamicTest0">
&lt;![CDATA[STATIC:\\TransportLocation=SMTP://someone@bts2006.com;
EndpointConfig=SMTPHOST=MySmtpHost&amp;
FROM=noreplyn@bts2006.com&amp;
SUBJECT=A Subject]]&gt;
</Resolvers>

 

Machine.Config settings:

<add key="SMTP"
         value="Blogical.Adapter.SMTP,
         Version=1.0.0.0, Culture=neutral,
         PublicKeyToken=c2c8b2b87f54180a" />

Supported Resolvers: STATIC, BRE, Blogical.Resolver.LDAP 

LDAP Resolver

The Blogical.Resolver.LDAP resolver makes an Active Directory lookup and populates the Resolution object with Mail address, SMTP server name, From address and Subject.

This Resolver only works with the SMTP Adapter Provider

Itinerary usage:

SQL Resolver

If you’d like to use a SQL database as a repository for your services and endpoints, the Blogical.Resolver.SQL might be what you’re looking for. In this sample I’ve created a table that maches the resolution object. The resolver expects a query where returning a single row, for example:

SELECT * FROM tblResolution WHERE id='CAAE0F7E-417C-4F18-9958-8EECB6F93CAE'

The Resolver will populate the Resolution dictionary with every column/value pair.

Itinerary usage:

<Resolvers serviceId="DynamicTest0">
&lt;![CDATA[SQL:\\DataSource=localhost;
InitialCatalog=EsbExceptionDb;
IntegratedSecurity=SSPI;
Query=select * FROM tblResolution where id='CAAE0F7E-417C-4F18-9958-8EECB6F93CAE']]&gt;
</Resolvers>

 

ESB Guidance...part 6

Filed under: , ,

Comments

# Mikael Håkanssons' Blog said on February 1, 2008 11:57 PM:

Extending the ESB Guidance If what you get from ESB Guidance is not enough, there are three areas you

# miguel telleria said on April 10, 2008 04:53 PM:

Hello, Actually i am working on a new proyect using the Biztalk ESB. For some specs i need an SMTP and a SQL adapter and your bolgical adapters helps us to start the implementation, but for the SQL adapter the orchestation part is not implemented, here is the code that will work with SQL adapter and orquestations:

/// <summary>

       /// This method is only called by Orchestrations, which is not supported at this time

       /// </summary>

       /// <param name="ResolverDictionary">Dictionary object contains

       /// end point information for the adapter provider to process</param>

       /// <param name="message">BizTalk XLANG message that allows us to set

       /// the BTS context properties of the message</param>

       public void SetEndpoint(Dictionary<string, string> ResolverDictionary, Microsoft.XLANGs.BaseTypes.XLANGMessage message)

       {

           //throw new ArgumentNullException("The SQL Adapter Provider does not support to be executed by Orchestrations");

           if (null == ResolverDictionary)

               throw new ArgumentNullException("ResolverDictionary");

           if (null == message)

               throw new ArgumentNullException("message");

           try

           {

               string transportLocation = ResolverDictionary["Resolver.TransportLocation"];

               string outboundTransportCLSID = ResolverDictionary["Resolver.OutboundTransportCLSID"];

               //Get parameters of the EndPoint              

               Dictionary<string, string> endpointConfig = String2Dictionary(ResolverDictionary["Resolver.EndpointConfig"]);

               // Database Connection string properties

               string integratedSecurity = GetValue(endpointConfig,"IntegratedSecurity");

               string persistSecurityInfo = GetValue(endpointConfig,"PersistSecurityInfo");

               string userID = GetValue(endpointConfig,"UserID");

               string password = GetValue(endpointConfig,"Password");

               string initialCatalog = GetValue(endpointConfig,"InitialCatalog");

               string dataSource = GetValue(endpointConfig,"DataSource");

               // Metadata Schema properties

               string documentTargetNameSpace = GetValue(endpointConfig,"DocumentTargetNameSpace");

               string outputRootElementName = GetValue(endpointConfig,"ResponseDocumentRootElementName");

               string connectionString = string.Empty;

               string outboundTransportLocation = "SQL://" + dataSource + "/" + initialCatalog;

               if (!String.IsNullOrEmpty(integratedSecurity) && integratedSecurity.Length > 0)

                   connectionString = String.Format(TRUSTEDCONNECTIONSTRINGFORMAT, integratedSecurity, persistSecurityInfo, initialCatalog, dataSource);

               else

                   connectionString = String.Format(CONNECTIONSTRINGFORMAT, persistSecurityInfo, userID, password, initialCatalog, dataSource);

               //AdapterMgr.SetMsgProperty(message, typeof(BTS.OutboundTransportLocation), transportLocation);

               AdapterMgr.SetMsgProperty(message, typeof(BTS.OutboundTransportLocation), outboundTransportLocation);

               AdapterMgr.SetMsgProperty(message, typeof(BTS.OutboundTransportType), "SQL");

               AdapterMgr.SetMsgProperty(message, typeof(BTS.OutboundTransportCLSID), outboundTransportCLSID);

               Assembly assembly = null;

               // Load the assembly propertySchemas

               assembly = System.Reflection.Assembly.Load("Microsoft.BizTalk.GlobalPropertySchemas");

               try

               {

                   // Get the types of the adapter properties

                   Type SQLConnectionString = assembly.GetType("SQL.ConnectionString");

                   Type SQLResponseDocument = assembly.GetType("SQL.ResponseDocumentRootElementName");

                   Type SQLDocumentTarget = assembly.GetType("SQL.DocumentTargetNamespace");

                   // Set the adapter properties

                   AdapterMgr.SetMsgProperty(message, SQLConnectionString, connectionString);

                   AdapterMgr.SetMsgProperty(message, SQLResponseDocument, outputRootElementName);

                   AdapterMgr.SetMsgProperty(message, SQLDocumentTarget, documentTargetNameSpace);

               }

               catch (System.Exception ex)

               {

                   EventLogger.Write(MethodInfo.GetCurrentMethod(), ex);

                   throw;

               }

           }

           catch (System.Exception ex)

           {

               EventLogger.Write(MethodInfo.GetCurrentMethod(), ex);

               throw;

           }

       }

Leave a Comment

(required) 
(required) 
(optional)
(required) 

This Blog

News

    MVP - Microsoft Most Valuable Professional BizTalk User Group Sweden BizTalk blogdoc

    Follow me on Twitter Meet me at TechEd

    Visitors

    Locations of visitors to this page

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Syndication