An Avanade Blogging Community

Welcome to An Avanade Blogging Community Sign in | Join | Help
in Search

Francisco Ruiz From Málaga (Spain)

BizTalk configuration with the Business Rule Engine


We can use the rules engine to store parameters that can be accessed from orchestrations.

To add parameters that can be accessed from an orchestration, there are two basic steps:

 

  1. To create the parameters in a vocabulary in the rules engine and save them.

            a. Open the Microsoft Business Rule Composer.

 

 

 

            b. Add the new vocabulary.

 

 

 

  

     2.   To add .NET code to a BizTalk Helper class to access the vocabulary through the rules engine API.

 

            a. We can use the following code based and corrected of the code available at: http://www.apress.com/ApressCorporate/supplement/1/10137/1590597117-3814.pdf

 

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.RuleEngine;

using System.Collections;

 

namespace LibraryBizTalk

{

public class LibraryBizTalkClass

{

   private LibraryBizTalkClass() {}

   

       public static bool GetVocabularyConstantValue(

                 string strVocabularyName,

                    string strConstantName,

                    string strVersion,

                    ref string strConstantValue,

                    ref string strConstantType)

       {

          RuleStore rlsRuleStore;

          VocabularyInfoCollection vicVocabInfo;

          Vocabulary vocVocab;

          RuleSetDeploymentDriver rsdDriver = new RuleSetDeploymentDriver();

          LiteralDefinition litDef;

          Boolean blnConstantFound = false;

          rlsRuleStore = rsdDriver.GetRuleStore();

          if (String.IsNullOrEmpty(strVersion))

          {

            vicVocabInfo = rlsRuleStore.GetVocabularies(strVocabularyName,

            RuleStore.Filter.Latest);

          }

          else

          {

            vicVocabInfo = rlsRuleStore.GetVocabularies(strVocabularyName,

            RuleStore.Filter.All);

          }

          // check to see that the vocabulary searched on has returned data

          if (vicVocabInfo.Count > 0)

          {

            for (int x = 0; x < vicVocabInfo.Count; x++)

            {

              vocVocab = rlsRuleStore.GetVocabulary(vicVocabInfo[x]);

              // Check to see that the version equals the version being

           // searched for or that the version passed in was a

           // wildcard (Null)

              if (String.IsNullOrEmpty(strVersion) ||

              ((vocVocab.CurrentVersion.MajorRevision + "." +

              vocVocab.CurrentVersion.MinorRevision) == strVersion))

              {                       

                // check that the constant being searched for exists

             // in the vocabulary

                if (vocVocab.Definitions.ContainsName(strConstantName))

                {

                litDef = (LiteralDefinition)         

                      vocVocab.Definitions.GetByName(strConstantName);

                  strConstantType = litDef.Value.GetType().ToString();

                  strConstantValue = litDef.Value.ToString();

                  blnConstantFound = true;

                  // exit loop

                  break;

                }

              }

            }

          }

          return blnConstantFound;

        }

     }

   }

 

 

 b. You can use the following code to invoke the previuos class from an orchestration Expresion shape.

 

strType = "string";

// the following string is the name of the vocabulary

strVocabularyName = "Configuracion";

LibraryBizTalk.LibraryBizTalkClass.GetVocabularyConstantValue(strVocabularyName, "ValPar1", "",ref strValue,ref strType);

 

 

 

At the following links you have other alternatives to the BizTalk configuration:

Note: SSO can be your better option.

 

http://geekswithblogs.net/gwiele/archive/2004/11/17/15168.aspx (The BizTalk Configuration Dilemma)

http://www.masteringbiztalk.com/blogs/jon/PermaLink,guid,6e4b84db-d15f-45e9-b245-08b1eb6c4def.aspx (How to store configuration data in the Enterprise Single Sign-On Database (SSO))

http://biztalkblogs.com/nishil/archive/2006/11/28/1534.aspx (Storing Usernames, Passwords in SSODB Database using MMC 3.0 )

http://seroter.wordpress.com/2007/09/21/biztalk-sso-configuration-data-storage-tool/ (Utility to lower the barrier of entry for SSO)

http://geekswithblogs.net/michaelstephenson/archive/2008/05/25/122381.aspx (Where do I store my custom configuration for a BizTalk solution)

 

Regards,

Francisco Ruiz

 

 

Published Thursday, April 05, 2007 7:14 AM by fran-1980
Filed Under:

Comments

No Comments
Anonymous comments are disabled

This Blog

Post Calendar

<April 2007>
SuMoTuWeThFrSa
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

News

Reading/Read

DISCLAIMER: The opinions expressed here in are my own personal opinions and do not represent my employer's view in any way.

Syndication