biztalk 2010

Upload: miguel-munoz-gonzalez

Post on 01-Jun-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Biztalk 2010

    1/52

  • 8/9/2019 Biztalk 2010

    2/52

    Lesson 1: Introduction to Business Rules

    esson objective:

    -escribe the concepts and terminolo$y used when worin$ with business rules inBizTal !erver )*+*.

    Lesson Overview

    Because an or$anizations business rules can chan$e fre%uently, BizTal!erver enables you to create business rules that can be modi/ed %uicly andeasily to meet chan$in$ business needs and the needs of your customers. Inthis lesson, you will learn what a business rule is and how business rules areinte$rated into a BizTal application environment. 0ou will also see howdevelopers, business analysts, and administrators wor to$ether in order tocreate, deploy, and maintain business rules.

  • 8/9/2019 Biztalk 2010

    3/52

    What Are Business Rules?

    -escribe business rules and e(plain how they can be used to mae businessdecisions.

    Business Rules

    Business rules are statements that $overn the conduct of business processes.1policy is a collection of related rules that are evaluated to$ether, fore(ample, a bans loan approval policy mi$ht be composed of severaldi2erent rules that need to be evaluated. The policy is e(ecuted, and eachrule is evaluated and possibly applied.

    #ach rule consists of a condition 3an if clause4 and a resultin$ action 3a thenclause4. The conditions and actions can be %uite simple or very comple(. The

    condition is evaluated, and if it evaluates to True, the speci/ed actions areperformed by the rule en$ine. 5nlie in most pro$rammin$ models, there isno else action. 6or e(ample, if you want to perform an action on all purchaseorders, but the action varies based on the total order amount, you wouldneed to create two rules, one for purchase orders with a total of less then7+,*** and one rule for purchase orders with totals $reater than or e%ual to7+,***. These two rules would mae up the discount policy.

  • 8/9/2019 Biztalk 2010

    4/52

    8ithin a policy, the various rules can have di2erent priorities assi$ned. Thesepriorities do not modify the order of evaluation but rather the order that therules are /red in. That is, if multiple rules are to be /red 3on the a$enda4, thepriority will determine the order that the rules are applied. In this case, therule that has the hi$hest assi$ned priority will be /red.

    Example9onsider the followin$ e(ample business rule from the precedin$ illustration.

    1 manufacturer has received a purchase order from a customer and needs toful/ll the purchase order re%uest. In order to process the purchase order, themanufacturer must answer a series of %uestions:

    Is this purchase order from an e(istin$ customer or a new customer Ifthe customer is new, the customer must be added to the database. Ifthe customer already e(ists, the ne(t step in the business rule can becalled.

    Is the product bein$ ordered a product that we manufacture If so, wecan continue processin$ the purchase order. If not, the purchase ordermust be declined.

    9an we supply the product bein$ re%uested If the %uantity on hand isless than the order %uantity, we can supply the product. If not, we willeither have to decline the purchase order or send a bacorder notice.

    'otice in the e(ample that each %uestion can be answered either TrueorFalse. These rules apply basic business lo$ic to /nd out whether or not apurchase order can be ful/lled.

    Business rules can be used to:

    Trigger notications.6or e(ample, if a product is low on inventory, abusiness rule could tri$$er a reorder notice for the product.

    Automate approvals.0ou could use a business rule, for e(ample, toroute documents with a total order amount over 7+*,*** to a mana$erfor approval.

    Reroute documents.If a purchase order is from a new customer, youcould route the purchase order to another business process thathandles new customers.

    Business Rule Engine

    !ince business rules embedded in applications can chan$e over time, BizTal

    !erver )*+* provides the Business "ule #n$ine 3B"#4 to enable you to createand modify sets of business rules. These rules can be created $raphicallyusin$ a tool called the Business "ule 9omposer or can be written usin$ theBusiness "ule 1&Is. ;nce published, the policy can be called from a BizTalorchestration and e(ecuted by the Business "ule #n$ine.

    The B"# enables business rule policies to be chan$ed in real time. 1nyorchestrations that use 3call4 the business rules need not be recoded orrebuilt when the business policy chan$es. Business rules are versioned

  • 8/9/2019 Biztalk 2010

    5/52

    to$ether as part of a businesspolicy, and all a business analyst needs to dowhen a rule chan$es is create a new version of a policy and then deploy thepolicy.

    Note:1lthou$h typically used in conjunction with BizTal orchestrations,business rule policies can be called from any .'#T assembly by usin$ the

    supplied 1&Is. The focus of this module will be on usin$ business rules inconjunction with orchestrations. The BizTal !erver )*+* documentationcontains more information about callin$ business rules pro$rammatically,includin$ an e(ample in the BizTal !-

  • 8/9/2019 Biztalk 2010

    6/52

    What Are Rules, Policies, and Vocabularies?

    -e/ne common business rule terminolo$y.

    Overview

    The followin$ sections describe common business rule terminolo$y.

    Rule

    Business rulesare statements that $overn the conduct of business processes.Business rules consist of a condition and one or more conse%uent actions.9onditions are true=false, otherwise nown as Boolean e(pressions, thatconsist of one or more predicates applied to facts. Multiple conditions can becombined to provide for comple( computations. 9omple( conditions can beconstructed by joinin$ multiple simple conditions usin$ 1'-, ;", and ';T

    modi/ers. 6or e(ample, when evaluatin$ a customer order, you could have arule such as: If customer e(ists 1'- total order amount > +*** ;" ifcustomer e(ists 1'- customer ratin$ ? e(cellent T@#' set discount amount? +*A.

    Polic

    Policies are lo$ical rule sets. 0ou compose a version of a policy, save it, test itby applyin$ it to facts, and when you are satis/ed with the results, publish it

  • 8/9/2019 Biztalk 2010

    7/52

  • 8/9/2019 Biztalk 2010

    8/52

    How Rules and Facts Work

    -e/ne business rules, actions, and facts.

    Business Rules

    1 business ruleconsists of a condition and one or more resultin$ actions. 1smentioned before, business rules are IfThenconditions, and there is no !lseclause. #ach business rule either returns Trueor False.

    $onditions

    1 conditionis a TrueFalse3Boolean4 e(pression that consists of one or morepredicates applied to facts. &redicates can be combined with the lo$icalconnectives 1'-, ;", and ';T to form a lo$ical e(pression that is potentially%uite lar$e but that will always evaluate to either True or 6alse.

    %ctions

    1n actionis the functional conse%uence of condition evaluation. If a rulecondition is met, a correspondin$ action or actions are initiated. 1ctions arerepresented in the Business "ule 6ramewor as Microsoft .'#TGbased objectsor as set operations on FM documents or database tables. 6or e(ample, if abusiness rule that checs whether or not a customer is preferred returns true,you could then call a method of a .'#T class to e(ecute code in the class. 0ou

  • 8/9/2019 Biztalk 2010

    9/52

    could also update elements or attributes in an FM schema document, or youcould update data in a Microsoft !D !erverH database. 0ou can e(ecutemore than one action within the T@#' clause.

    &acts

    Facts are the data that rules use to mae decisions. 6acts can be derived

    from multiple data sources and must be fed into the rule en$ine throu$h prede/ned vocabularies, FM schemas, .'#T classes, or database row sets. Manyfacts are instance facts that will be di2erent for each /rin$ of the rules. 6ore(ample, the customer name and account number /elds in a &; messa$e areinstance facts. ;ther facts may be lon$ term. 6or e(ample, interest ratesusually chan$e infre%uently and do not need to be looed up each time a ruleis /red. on$term facts are determined once and then held in the cache untilrefreshed, whereas instance facts are determined for each rule e(ecution. 1fact can be con/$ured as a lon$term fact by settin$ the &act Retrieverproperty for each version of the policy in the properties window for theversion of the policy. 1 fact retriever object must be created to be able tofetch the facts from a persistent stora$e and present them to the policyobject.

    6or More Information6or more information on creatin$ a lon$term fact, referto the BizTal !erver )*+* documentation 9reatin$ a 6act "etrieverJ and!hortTerm 6acts vs. on$Term 6acts.J

  • 8/9/2019 Biztalk 2010

    10/52

    Business Rule !ecution

    -e/ne business rules, actions, and facts.

    Business Rule Execution

    The Business "ule #n$ine uses a threesta$e al$orithm for policy e(ecution.The sta$es are as follows:

    'atc(. In the match sta$e, facts are matched a$ainst the predicates that usethe fact type 3object references maintained in the rule en$ineKs worin$memory4 usin$ the predicates de/ned in the rule conditions. 6or the sae ofeEciency, pattern matchin$ occurs over all the rules in the policy, andconditions that are shared across rules are matched only once. &artial

    condition matches may be stored in worin$ memory to e(pedite subse%uentpatternmatchin$ operations. The output of the patternmatchin$ phaseconsists of updates to the rule en$ine a$enda.

    $on)ict resolution. In the conLict resolution sta$e, the rules that arecandidates for e(ecution are e(amined to determine the ne(t set of ruleactions to e(ecute based on a predetermined resolution scheme. 1llcandidate rules found durin$ the matchin$ sta$e are added to the ruleen$ineKs a$enda.

  • 8/9/2019 Biztalk 2010

    11/52

    The default conLict resolution scheme is based on rule priorities within apolicy. The priority is a con/$urable property of a rule in the Business "ule9omposer. The lar$er the number, the hi$her the priority therefore if multiplerules are tri$$ered, the hi$herpriority actions are e(ecuted /rst.

    %ction. In the action sta$e, the actions in the resolved rule are e(ecuted.'ote that rule actions can assert new facts into the rule en$ine, which causesthe cycle to continue. This is also nown as forward chainin$. It is importantto note that the al$orithm never preempts the currently e(ecutin$ rule. 1llactions for the rule that is currently /rin$ will be e(ecuted before the matchphase is repeated. @owever, other rules on the a$enda will not be /redbefore the match phase be$ins a$ain. The match phase may cause thoserules on the a$enda to be removed from the a$enda before they ever /re.

  • 8/9/2019 Biztalk 2010

    12/52

    Business Rules "rchestration #cenarios

    -escribe scenarios for inte$ratin$ business rules within an orchestration.

    $ommon Orc(estration #cenarios

    Instead of havin$ to code and recode constantly chan$in$ business policiesand lo$ic within your comple( business processes, you can incorporate a callto the Business "ule #n$ine and thus allow information worers to update therules as needed.

    Overview

    0ou can inte$rate business rules into your orchestrations to support a varietyof scenarios:

    0ou can use rules to determine whether another business processneeds to be e(ecuted. 6or e(ample, after successfully placin$ acustomer order, you mi$ht want to call a second orchestration thathandles the shippin$ of orders.

    0ou can use rules to evaluate business lo$ic and to determine when abusiness process re%uires a variable delay. 6or e(ample, you mi$ht setup a loop to chec on the status of an item to see if the item is instoc. 1fter initially checin$ the stoc of an item that is not available,the rule delay would be one minute. The ne(t time, the rule would wait

  • 8/9/2019 Biztalk 2010

    13/52

    /ve minutes before e(ecutin$, the followin$ time, the rule would waitN* minutes before e(ecutin$, and so on.

    0ou can use rules to determine the e(ecution path for a businessprocess, basin$ the determination on the results of the rule e(ecution.6or e(ample, if the customer submittin$ the purchase order does note(ist in the database, you could route the document to anotherbusiness process to add the customer to the database beforecontinuin$ to process the purchase order.

  • 8/9/2019 Biztalk 2010

    14/52

    Identi$%in& Business Rule Personas

    Identify job roles and responsibilities for mana$in$ business rules.

    Overview

    The Business "ules 6ramewor incorporates a $raphical user interfaceOtheBusiness "ule 9omposerOthat developers, information worers, andadministrators can all use in various ways to develop and apply both rulesand policies.

    -evelopers can:

    9reate the orchestrations from which the business rules will be called,and they de/ne the action to be taen when a decision is returned tothe orchestration. 1s lon$ as the decision path within the orchestration

    does not chan$e, the orchestration will not need to be redeployed.

    9reate the initial business rule policies and create vocabularies tomae it easier for information worers to edit and understand businessrule policies.

    Information worers can:

    -esi$n, test, and mana$e business policies. 9han$es made to a B"#policy will be e(ecuted from an orchestration without havin$ to

  • 8/9/2019 Biztalk 2010

    15/52

    recompile and redeploy the BizTal assembly. The B"# always calls thelatest deployed version of the policy.

    1dministrators can:

    !ecure business rule policies. By default, when a new policy or

    vocabulary is created in the rule store, only the user who created it andthe rule en$ine administrator have both read=e(ecute andmodify=delete access. The rule en$ine administrator can con/$urewhich users have the access level, or ri$hts, to perform di2erentoperations 3processes operate under user credentials4.

    -eploy business rule policies from one physical environment toanother. -eployin$ business rules to other physical environments isaccomplished by usin$ the "ules #n$ine -eployment 8izard and iscovered later in this module. "ules can also be e(ported and importedusin$ Microsoft 8indows Installer 3M!I4 paca$es.

    Monitor the results of e(ecuted business rules by usin$ the BizTal1dministration 9onsole. This tool allows auditin$ of the rulesbased

    decision made within each orchestration instance.

  • 8/9/2019 Biztalk 2010

    16/52

    Lesson ': Inte&ratin& Business Rules

    esson objective:

    9ompose, publish, and deploy business rules.

    Overview

    BizTal provides several tools for developin$ and deployin$ business rulesand for applyin$ them to business processes. In this lesson, you will learnhow to inte$rate a business rule policy into an orchestration and how to usethe Business "ule 9omposer to create easytounderstand vocabularies andpolicies. These policies can then be versioned and deployed before bein$called from an orchestration. 0ou can also trac business rules to /nd out thetrue or false outcome of a rule.

  • 8/9/2019 Biztalk 2010

    17/52

    #te(s $or Inte&ratin& Business Rules

    -escribe the steps re%uired to inte$rate business rules within an orchestration.

    *ntegrating Business Rules

    8hen developin$ rulebased applications, you must complete the followin$steps:

    +. Identify the business lo$ic that you would lie to represent with rules inyour application. The term business logiccan refer to a wide variety ofdecision processes, for e(ample, &urchase orders for more than /vehundred dollars must be approved by a mana$er.J

    ). Identify the data sources for your rule elements. ;ptionally, you canalso de/ne and publish vocabulariesOdomainspeci/c nomenclatures

    that represent underlyin$ bindin$s.N. 9reate rules either from your vocabulary de/nitions or directly from

    data bindin$s usin$ these rules, compose a policy that will representyour business lo$ic.

    "ptionally# you may choose to create a fact retriever and associateit $ith a policy to employ long%term facts. This step is used only if

    you $ant to employ a long%term fact# as discussed earlier in thismodule.

  • 8/9/2019 Biztalk 2010

    18/52

    P. Test and debu$ the policy by usin$ sample facts. 30ou can create aPolicTesterobject in your application. Testin$ a policy beforeinte$ratin$ it in an orchestration allows you to ensure that the policy isworin$ correctly before testin$ it from an orchestration.

    Troubleshootin$ a policy is much easier if you will test the policy beforeinte$ratin$ it with an orchestration. 6or more information on creatin$ a

    &olicyTester object to test a business policy, refer to the BizTal !erver)*+* documentation Testin$ &oliciesJ and 9reatin$ a 6act 9reator.J4

    Q. &ublish and deploy the policy version to the rule store. 1fter a policyversion is published, it is immutable but still not available for otherapplications to use the policy. -eployin$ the policy version maes thepolicy available to other applications.

    R. 9all the policy from a BizTal orchestration.

    a. Instantiate and build the shortterm fact list in the hostin$application.

    b. Instantiate a policy version in your hostin$ application, and then

    e(ecute it by usin$ your shortterm fact list. If you are usin$ aPolicTesterobject, replace it with a Policobject in yourapplication. Polic objects are used when e(ecutin$ lon$termfacts instead of shortterm facts.

    c. 1dd the call rules shape to the orchestration and provide theparameters used by the B"#.

    d. Monitor and trac rule e(ecution as needed. Business rule policytracin$ is con/$ured by usin$ the BizTal !erver )*+*1dministration 9onsole and is covered later in this module.

  • 8/9/2019 Biztalk 2010

    19/52

    )o*(osin& Business Rules

    5se the Business "ule 9omposer to de/ne business rules.

    Business Rule $omposer

    The Business "ule 9omposer is a $raphical user interface that allows you tocreate business rule policies, which contain one or more business rules.

    These rules can evaluate facts to determine if speci/c actions should beperformed. To assist in humanizin$ these rules, vocabularies can be createdthat provide a userfriendly alias to the terms and conditions. Multipleversions of the policies and vocabularies can be created, tested, published,and deployed usin$ the Business "ule 9omposer to mae mana$ement ofthese artifacts easier.

    $reate Business Rule Polic1 policy is a collection of rules. #ach rule is a conditional comparison of facts,which if the comparison evaluates to Truecauses the actions de/ned in therule to be e(ecuted. "ules are constructed in the "ule 9omposer pane byaddin$ predicates and facts 3which may be direct facts or may be based uponvocabularies4 and de/nin$ actions. 1'-, ;", and ';T operators can beadded to conditions to provide for comple( comparisons.

  • 8/9/2019 Biztalk 2010

    20/52

    6acts and actions are added by dra$$in$ them onto the "ule 9omposerdesi$n surface. 1ctions will modify nodes in the document speci/ed. This isone notable e(ception to the immutability of messa$es in BizTalorchestrations because the actions can update or even add new nodes and=ornodelists to the provided messa$e3s4. The Business "ule #n$ine 3B"#4 maeschan$es to the messa$es that it passes in the call to the en$ine. 6or this

    reason, you may want to create a speci/c messa$e that is sent to the en$inerather than havin$ the B"# chan$e the ori$inal document.

    In the earlier e(ample, the $ive the customer a &'A discountJ action willupdate the -iscount 1mount node in the1dventure8ors.;rders.9ustomer;rder messa$e.

    1dditional actions 3such as assertin$ and retractin$ facts4 can be added byri$htclicin$ the 1ctions node and then clicin$ the appropriate action.

    Testing+ Pu"lis(ing+ and ,eploing a Polic

    8hen a version of a policy is de/ned to the satisfaction of the business

    analyst, the policy should be tested prior to publishin$ it. The act ofpublishin$ the policy to the "ule !tore maes the policy available to the B"#.By default, the B"# uses a !D !erver database as the "ule !tore. @owever,rules can be e(ported to an FMbased "ule !tore as well. ;nce published,policy versions are immutable and cannot be chan$ed without creatin$ a newversion. "emember that rules must also be deployed before they can be usedby other applications.

    In order for the policy to be called from a BizTal application, the policy mustbe deployed. BizTal will always use the most recently deployed policyversion when the policy is called by an application, whereas when called froma .'#T assembly, a speci/c policy version is speci/ed.

    $reate a Business Rule !oca"ular

    &reviously we introduced a rule that said:

    If the !hoppin$ 9art contains more than 7+*** worth of items, then $ive thecustomer a +* percent discount.

    1s written, this rule is easy to understand. The rule is a Boolean comparison3$reater than4 between two variables: the shoppin$ cart and a value of +***.

    The action to be performed is to apply a +* percent discount to the totalorder. The problem is that computers do not thin in these terms. In computerterms, this loos lie:

    If9ompany.'amespace.!hoppin$9art.&urchase1mount > Dualifyin$ 1mount as!ystem.-ecimal

    Then9ompany.'amespace.9ustomer.-iscount1mount ?9ompany.'amespace.!hoppin$9art.&urchase1mount S .+

    8e create vocabularies to mae an obscure concept more human.

  • 8/9/2019 Biztalk 2010

    21/52

    1lthou$h rules can be created and used without the use of vocabularies,creatin$ vocabularies maes the creation and maintenance of rules mucheasier. Cocabularies abstract diEcult concepts by de/nin$ an alias to beassociated with schema nodes, database /elds, or .'#T classes. 8ithcorrectly de/ned vocabularies, policies can be maintained by 3if not initiallycreated4 by information worers.

    Two vocabularies, &redicates and 6unctions 3which are used in the creation ofall rules4, are built into the Business "ule 9omposer. It is possible to e(tendthese vocabularies as needed. 6or e(ample, the phrase The (hopping )artcontains more than 7 &'''worth of itemsJ is actually a greater thancomparison: 3!hoppin$9art > +***4. The builtin -reater T(anfunction inthe functions vocabulary could have an additional vocabulary term de/nedthat represents this relationship. This may mae it easier for informationworers to understand the relationship.

    Pu"lis(ing Business Rule !oca"ularies

    !imilar to policies, vocabularies must be published before they can be

    incorporated into a policy however, there is no option to deploy. If thevocabulary used in a policy chan$es, it will be necessary to update the policyto use the newly published vocabulary.

    &oreign Language #upport

    1lthou$h the e(amples here are usin$ the #n$lish lan$ua$e, vocabularies canbe written in various lan$ua$es, main$ data de/ned in databases andschemas more accessible to non#n$lish speaers.

  • 8/9/2019 Biztalk 2010

    22/52

    +e*onstration: sin& the Business Rule )o*(oser

    earn to e(amine and test a deployed business rule policy.'ote: In order to be able to fully e(plain the vocabularies and rules used inthis demonstration, you will need to complete the lab at the end of thismodule.

    To Examine Existing Business Rules

    + ;n the #tartmenu, point to %ll Programs, point to 'icroso.tBi/Tal #erver 2010, and then clic Business Rule $omposer.

    . In the Open Rule #toredialo$ bo(, clicO.

    U. In Microsoft Business "ule 9omposer, in the &olicy #(plorer pane,e(pand Loan%pp%pproval,!ersion 10 3 ,eploed, and !ersion

    11 3 ,eploed.The t$o policy versions have identical rules# e*cept that Version &.'is in readable !nglish because it uses vocabularies. Version &.&does not use vocabularies# and it is more di+cult to understand theconte*tual sense of $hat each rule is doing.

    V. In the 6acts #(plorer pane, under LoanProcess, e(pand !ersion 10 3Pu"lis(ed.

  • 8/9/2019 Biztalk 2010

    23/52

    A vocabulary is a collection of denitions that provide simple%to%read aliases for comple* message values or elds in a database.

    +*.9lic Base *ncome.

    The )urrent "rder Total denition refers to the Basic(alary eld ofthe message $hen it is received into the Business Rule !ngine

    ,BR!-. This value is from the oanApplication schema# $hich youcan see by e*amining the (chema and /Path properties in theProperties dialog bo*.

    ++.9lic 'ont( Range.

    The 0onth Range denition contains a set of predetermined values1these values are 2# 3# 4# &5# &6# and 57. 8hen used as part of arule# these values are displayed as a drop%do$n list.

    +).9lic 4pdate Loan #tatus.

    The 9pdate oan (tatus denition is used to update the (tatus eldof the message.

    +N. In &olicy #(plorer, under !ersion 11 3 ,eploed, clic %pproved.

    The )onditions pane sho$s that this rule is applied $henBasic(alary : "therIncome is greater than the oanAmount# and!mploymentTimeIn0onths is greater than or e;ual to 3# or theResidencyTimeIn0onths is greater than or e;ual to 3. The Actions

    pane sho$s that the oan(tatus eld $ill be assigned a value ofApproved.

    +P. In &olicy #(plorer, under !ersion 10 3 ,eploed, clic %pproved.

    Although this rule performs the same action as the Approved rule isversion &. itotice that oan(tatus is blan?# that the sum of Basic(alary and"therIncome is less than oanAmount# and both TimeIn0onthselds are less than 3. This message $ill be @enied.

  • 8/9/2019 Biztalk 2010

    24/52

    +R.9lose Microsoft Internet #(plorer.

    +. In &olicy #(plorer,ri$htclic !ersion 10 3 ,eploed, and then clicTest Polic.

    +U. In the #elect &actsdialo$ bo(, clic%dv7orsLoan%pprovalLoan%pplication, and then clic %dd

    instance.+V. In the Opendialo$ bo(, navi$ate to

    $:5%ll&iles5,emo$ode5'odule11, clic Loan%pplication 3%pproved 6 $opxml, and then clic Open.

    Be sure to ?eep a copy of the original message because theBusiness Rule !ngine $ill alter the test message.

    )*. In the #elect &actsdialo$ bo(, clic Test.

    )+. In the ;utput pane, notice that are two "5# 6I"#- events, one for theLoan to #alar Ratiorule, and one for the %pprovedrule.

    )). In 8indows #(plorer, navi$ate to and open

    $:5%ll&iles5,emo$ode5'odule115Loan%pplication 3 %pproved 6$opxml, and notice that the Loan#tatus/eld now reads%pproved, and the LoanTo*ncome /eld now reads0888.

    )N. In &olicy #(plorer, ri$htclic !ersion 10 3 ,eploed, and then clicTest Polic.

    )P. In the #elect &actsdialo$ bo(, clic$:5%ll&iles5,emo$ode5'odule115$op o. Loan%pplication 3%pprovedxml, and then clic the Remove instancebutton.

    )Q. In the #elect &actsdialo$ bo(, clic%dv7orsLoan%pprovalLoan%pplication, and then clic the %ddinstancebutton.

    )R. In the Opendialo$ bo(, navi$ate to$:5%ll&iles5,emo$ode5'odule11, select $op o. Loan%pplication3 ,eniedxml, and then clic Open.

    ou are using the copy of the original message because theBusiness Rule !ngine $ill alter the test message.

    ). In the #elect &actsdialo$ bo(, clic Test.

    )U. In the ;utput pane, notice that are three "5# 6I"#- events, one forthe Loan to #alar Ratiorule, one for the ,enied *ncome rule, andone for the ,enied Residenc or Emploment rule.

    )V. In 8indows #(plorer, navi$ate to and open$:5%ll&iles5,emo$ode5'odule115$op o. Loan%pplication 3,eniedxml, and notice that the Loan#tatus/eld now reads ,enied,and the LoanTo*ncome /eld now reads12.

    N*.&ause the "t10d6demosvirtual machine.

  • 8/9/2019 Biztalk 2010

    25/52

    +e(lo%in& Business Rules

    -eploy policies.

    Overview

    1fter a policy is published, it must be deployed before it can be used bye(ternal processes. The shortcut menu in the Business "ules 9omposer hasan option to deploy the policy. The "ule #n$ine -eployment 8izard, found onthe BizTal pro$ram menu, can be used to e(port and import business rulepolicies to and from a Business "ule an$ua$e 3B"4 /le and to publishpolicies to the !D rule store. 0ou can use this wizard in development,sta$in$, and production environments.

    BizTal !erver provides the ability to import, e(port, deploy and undeploy

    policies and vocabularies in the Business "ules database by usin$ the BizTal!erver 1dministration 9onsole. This assumes, however, that the policies andvocabularies are e(ported and imported as part of a BizTal applications M!Ipaca$e.

    0ou may also e(port and import policies and vocabularies as FM /les byusin$ the "ule #n$ine -eployment 8izard.

    The "ule #n$ine -eployment 8izard allows you to:

  • 8/9/2019 Biztalk 2010

    26/52

    #(port a version of a policy or a vocabulary from an !D rule store intoa /le rule store. This creates an FM /le that contains the con/$urationinformation for the policy or vocabulary bein$ e(ported. This FM /lecan then be copied to another computer to be imported at a later date.

    Import a version of a policy or vocabulary from a /le rule store into an!D rule store.

    -eploy a version of a policy and publish a vocabulary from an !D rulestore to a production !D rule store so that the policy can be run withina rulebased application. -eployin$ a rule maes the rule available toother business processes.

    5ndeploy a version of a policy and remove a vocabulary from an !Drule store to mae the policy unavailable for use by a rulebasedapplication. 5ndeployin$ a version of a policy does not remove thepolicy from the database. The policy is still saved in the "ules #n$inedatabase, but it cannot be used by other applications. 5se this if youwant to revert to a previous version of the policy.

  • 8/9/2019 Biztalk 2010

    27/52

    Inte&ratin& Business Rules into an "rchestration

    Inte$rate business rules into an orchestration.

    *ntegrating Business Rules

    0ou can incorporate business rules within your BizTal orchestrations byperformin$ the followin$ tass:

    1ddin$ a call rules shape inside the orchestration and settin$ the$on9gure Policproperty to specify the business rule you are callin$.

    0ou specify only the name of the business policy you will be callin$ andnot the version number of the policy. The most current version of thepolicy will always be used when callin$ from an orchestration.

    In many cases, you will want to de/ne a separate Messa$e variableand add a messa$e construct shape to the orchestration. This willallow you to construct a messa$e that contains only the values thatwill be needed by the B"#. 1lso, since the B"# call can modify thesubmitted messa$e, you may want to submit a copy rather then theori$inal messa$e. 5se the ;rchestration Ciew window to create amessa$e variable that maps to the messa$e type of the messa$e youwill be sendin$ to the B"#.

  • 8/9/2019 Biztalk 2010

    28/52

    5sin$ a decision shape 3or other shape4 to process the response fromthe Business "ule #n$ine. ;ther shapes at this step that could be usedinstead include the -elay shape and the 9all ;rchestration shape,dependin$ on what you want to do after receivin$ the results of thebusiness policy.

  • 8/9/2019 Biztalk 2010

    29/52

    +e*onstration: Inte&ratin& Business Rules into an "rchestration

    earn to con/$ure the call rules orchestration shape.

    %dd a $all Rules #(ape

    + "esume the "t10d6demosvirtual machine.

    ) In 8indows #(plorer, navi$ate to$:5%ll&iles5,emo$ode5'odule115%dv7ors, and then doubleclic%dv7orsslnto open the solution.

    N+. In !olution #(plorer, doubleclic ProcessLoansodxto open theorchestration.

    N).6rom the Toolbo(, dra$ a $all Rules shape to the orchestration directlybelow the Receive $redit #O shape.

    NN. In the 9all"ulesW+ &roperties window, in the Namebo(, type $all Loan%pproval Polic, and then clic the ellipsis 3X4 button ne(t to the$on9gure Policbo(.

    NP.9hoose Loan%pp%pprovalfrom the #elect t(e "usiness polic ouwis( to calllist, set the Parameter Nameto msgLoan%pp, andthen clic O.

  • 8/9/2019 Biztalk 2010

    30/52

    This orchestration $ill no$ pass the msgoanApp message to theBusiness Rule !ngine# relying on it to e*ecutethe oanAppApproval

    policy# and update the message

  • 8/9/2019 Biztalk 2010

    31/52

    -rackin& Business Rules Polic% !ecution

    Trac business rule e(ecution.

    Tracing Polic Execution

    0ou can monitor business rule activities and trac the overall pro$ress of anorchestration that uses the Business "ules 6ramewor by usin$ the BizTal!erver )*+* 1dministration 9onsole. 0ou can view a list of the deployedbusiness rule policies, and you can view and chan$e the current tracin$con/$uration for any currently deployed policies.

    To set tracin$ options for a policy, select the application associated with therule, and then clic &olicies. 1ll polices that are associated with thisapplication 3and all versions of these policies4 are displayed. If the policy that

    you want to mana$e is not displayed, ri$htclic &olicies to add the policy tothe application.

    Tracing Options

    To con/$ure tracin$ properties for a policy, ri$htclic the policy to access itsproperties and to con/$ure tracin$. There are four options for tracin$business rules from the BizTal !erver 1dministration 9onsole:

  • 8/9/2019 Biztalk 2010

    32/52

    + 6act 1ctivity. !elect this chec bo( when tracin$ the instance data onwhich the policy operates.

    NR.9ondition #valuation. This chec bo( allows you to trac the TrueFalseresult of the conditions in the selected policy.

    N."ule 6irin$s. This chec bo( allows you to trac the actions tri$$ered as

    a result of the policy.NU.1$enda 5pdates. !elect this chec bo( when you want to trac

    updates to the a$enda, which contains a list of actions that evaluatedto Trueand a list of rules that /red.

    ;nce you have turned on tracin$ for your business policies, e(ecute your%ueries as normal in the BizTal !erver 1dministration 9onsole. 0ou shouldsee a lin to access the business rule e(ecution for each messa$e that wasprocessed by the Business "ule #n$ine. 0ou can then see the TrueFalsevalues of policies that were e(ecuted in the B"# alon$ with the If!lsecondition that was evaluated.

    &olices that have been added to an application can be mana$ed with the restof the application. This includes the ability to undeploy policies and to includethe policies when the M!I is e(ported. 5ndeployed policies will still be visiblewithin the application. In this way, policies can be mana$ed by undeployin$and redeployin$ the application as necessary.

  • 8/9/2019 Biztalk 2010

    33/52

    Lab: Inte&ratin& Business Rules

    Time estimated: 0 minutes

    #cenario

    The Microsoft Business "ule #n$ine 3B"#4 enables you to apply declarativerules based on messa$es from BizTal orchestrations. 5sin$ the B"# enablesyou to separate the implementation of the business process 3orchestration4from business decisions that are liely to chan$e over time. Cocabularies area collection of easytoread de/nitions for the facts used by the B"#. 8henvocabularies are used to create rules, the rules can easily be updated andmaintained by business analysts who have little or no understandin$ of theBizTal implementation. In this lab, you will create a vocabulary with severalde/nitions. 0ou will then create a rule policy by usin$ the vocabulary you

    created. 6inally, you will inte$rate the Business "ule #n$ine policy into anorchestration.

  • 8/9/2019 Biztalk 2010

    34/52

    #tart t(e !irtual 'ac(ine

    &rocedure ist+. If the #erver 'anagerwindow is not already open, clic on the

    #erver 'anagericon located in the tas bar ne(t to the #tartbutton.

    ). #(pand Roles+ ;per6!+ ;per6! 'anager The last node to appeardisplays the machine name. 9lic on it to see the list of virtualmachines available.

    N. -oubleclic the virtual machine "t10d611to open a!irtual 'ac(ine$onnectionwindow.

    P. 9lic on the %ctionmenu in the Cirtual Machine 9onnection windowand choose #tart

    Q. ;nce the virtual machine starts, press $TRL

  • 8/9/2019 Biztalk 2010

    35/52

    !ercise 1: )reatin& a Business Rule n&ine Vocabular%

    Overview

    The Business "ule #n$ine 3B"#4 maes decisions based on facts derivedfrom .'#T classes, FM schemas, and !D databases. The sources of thesefacts can be diEcult for humans to read and understand. Cocabularyde/nitions are humanfriendly aliases for the facts used by the B"#. In thise(ercise, in order to simplify the creation of business rules, you will create avocabulary that contains several de/nitions.

    $reate a New Business Rule !oca"ular

    &rocedure ist+ ;n the #tartmenu, clic %ll Programs, clic 'icroso.t Bi/Tal

    #erver 2010, and then clic Business Rule $omposer.

    P+. In the Open Rule #toredialo$ bo(, clic O.

    P). In the 6acts #(plorer pane, on the !oca"ulariestab, ri$htclic!oca"ularies, and then clic %dd New !oca"ular.

    PN."ename the new vocabulary to LoanProcessing.

    Vocabularies contain reusable mappings bet$een user%friendly te*tand the underlying data sources used in a rule denition.

    $reate New >-et? Operation ,e9nitions

    &rocedure ist+ 5nder oan&rocessin$, ri$htclic !ersion 10 @not savedA, and then

    clic %dd New ,e9nition.

    PP.;n the 7elcome to t(e !oca"ular ,e9nition 7i/ardpa$e, clic

    'L ,ocument Element or %ttri"ute, and then clic Next.PQ. In the ,e9nition namebo(, type Primar *ncome.

    PR. In the ,e9nition descriptionbo(, type %mount o. principalincome.

    P.9lic the Browsebutton, navi$ate to$:5%ll&iles5La"&iles5La"115%dv7ors5Loan%pproval5Loan%pplicationxsd, and then clic Open.

    PU. In the #elect Bindingdialo$ bo(, e(pand Loan%ppand *ncome, clicBasic#alar, and then clic O.

    PV.9lic Per.orm >-et? operation.

    Q*. In the ,ispla namebo(, type 'ont(l Primar *ncome, and thenclic &inis(.

    Q+.5nder oan&rocessin$, ri$htclic !ersion 10 @not savedA, and thenclic %dd New ,e9nition.

    Q).;n the 7elcome to t(e !oca"ular ,e9nition 7i/ardpa$e, clic'L ,ocument Element or %ttri"ute, and then clic Next.

    QN. In the ,e9nition namebo(, type Emploment @mont(sA.

  • 8/9/2019 Biztalk 2010

    36/52

    QP. In the ,e9nition descriptionbo(, type Lengt( o. emploment.

    QQ.9lic the Browsebutton, navi$ate to$:5%ll&iles5La"&iles5La"115%dv7ors5Loan%pproval5Loan%pplicationxsd, and then clic Open.

    QR. In the #elect Bindingdialo$ bo(, e(pand Loan%ppand

    Emploment, clic Time*n'ont(s, and then clic O.Q.9lic Per.orm >-et? operation.

    QU. In the ,ispla namebo(, type 'ont(s Emploed, and then clic&inis(.

    QV.5nder oan&rocessin$, ri$htclic !ersion 10 @not savedA, and thenclic %dd New ,e9nition.

    R*.;n the 7elcome to t(e !oca"ular ,e9nition 7i/ardpa$e, clic'L ,ocument Element or %ttri"ute, and then clic Next.

    R+. In the ,e9nition namebo(, type Loan %mount.

    R). In the ,e9nition descriptionbo(, type ,esired loan amount.

    RN.9lic the Browsebutton, navi$ate to$:5%ll&iles5La"&iles5La"115%dv7ors5Loan%pproval5Loan%pplicationxsd, and then clic Open.

    RP. In the #elect Bindingdialo$ bo(, e(pand Loan%ppandLoan$onditions, clic Loan%mount, and then clic O.

    RQ.9lic Per.orm >-et? operation.

    RR. In the ,ispla namebo(, type ReCuested Loan %mount, and thenclic &inis(.

    R.5nder oan&rocessin$, ri$htclic !ersion 10 @not savedA, and thenclic %dd New ,e9nition

    RU.;n the 7elcome to t(e !oca"ular ,e9nition 7i/ardpa$e, clic'L ,ocument Element or %ttri"ute, and then clic Next.

    RV. In the ,e9nition namebo(, type Residenc @mont(sA.

    *. In the ,e9nition descriptionbo(, type Lengt( at residence.

    +.9lic the Browsebutton, navi$ate to$:5%ll&iles5La"&iles5La"115%dv7ors5Loan%pproval5Loan%pplicationxsd, and then clic Open.

    ). In the #elect Bindingdialo$ bo(, e(pand Loan%ppand Residenc,clic Time*n'ont(s, and then clic O.

    N.9lic Per.orm >-et? operation.P. In the ,ispla namebo(, type 'ont(s at $urrent Residence, and

    then clic &inis(.

    Q.5nder oan&rocessin$, ri$htclic !ersion 10 @not savedA, and thenclic %dd New ,e9nition.

    R.;n the 7elcome to t(e !oca"ular ,e9nition 7i/ardpa$e, clic'L ,ocument Element or %ttri"ute, and then clic Next.

  • 8/9/2019 Biztalk 2010

    37/52

    . In the ,e9nition namebo(, type #econdar *ncome.

    U. In the ,e9nition descriptionbo(, type *ncome .rom sources ot(ert(an primar income.

    V.9lic the Browsebutton, navi$ate to$:5%ll&iles5La"&iles5La"115%dv7ors5Loan%pproval5Loan%pplica

    tionxsd, and then clic Open.U*. In the #elect Bindingdialo$ bo(, e(pand Loan%ppand *ncome, clic

    Ot(er*ncome, and then clic O.

    U+.9lic Per.orm >-et? operation.

    U). In the ,ispla namebo(, type 'ont(l #econdar *ncome, andthen clic &inis(.

    $reate t(e 4pdate Loan #tatus >#et? Operation ,e9nition

    &rocedure ist

    + 5nder oan&rocessin$, ri$htclic !ersion 10 @not savedA, and thenclic %dd New ,e9nition.

    UN.;n the 7elcome to t(e !oca"ular ,e9nition 7i/ardpa$e, clic'L ,ocument Element or %ttri"ute, and then clic Next.

    UP. In the ,e9nition namebo(, type 4pdate Loan #tatus.

    UQ.9lic the Browsebutton, navi$ate to$:5%ll&iles5La"&iles5La"115%dv7ors5Loan%pproval5Loan%pplicationxsd, and then clic Open.

    UR. In the #elect Bindingdialo$ bo(, e(pand Loan%ppandLoan$onditions, clic Loan#tatus, and then clic O.

    U.9lic Per.orm >#et? operation, and then clic Next.UU. In the ,ispla .ormat stringbo(, type 4pdate t(e Loan #tatus .or

    t(is loan to D0, and then clic &inis(.

    $reate t(e #et Loan to *ncome Ratio >#et? Operation ,e9nition

    &rocedure ist+ 5nder oan&rocessin$, ri$htclic !ersion 10 @not savedA, and then

    clic %dd New ,e9nition.

    UV.;n the 7elcome to t(e !oca"ular ,e9nition 7i/ardpa$e, clic'L ,ocument Element or %ttri"ute, and then clic Next.

    V*. In the ,e9nition namebo(, type #et Loan to *ncome Ratio.

    V+.9lic the Browsebutton, navi$ate to$:5%ll&iles5La"&iles5La"115%dv7ors5Loan%pproval5Loan%pplicationxsd, and then clic Open.

    V). In the #elect Bindingdialo$ bo(, e(pand Loan%ppandLoan$onditions, clic LoanTo*ncome, and then clic O.

    VN.9lic Per.orm >#et? operation, and then clic Next.

  • 8/9/2019 Biztalk 2010

    38/52

    VP. In the ,ispla .ormat stringbo(, type T(e loan to income ratio.or t(is loan is: D0, and then clic &inis(.

    $reate t(e 'ont( Range ,e9nition

    &rocedure ist+ 5nder oan&rocessin$, ri$htclic !ersion 10 @not savedA, and then

    clic %dd New ,e9nition.

    F8 ;n the 7elcome to t(e !oca"ular ,e9nition 7i/ardpa$e,clic $onstant !alue+ Range o. !alues+ or #et o. !alues, and thenclic Next.

    F In the ,e9nition namebo(, type 'ont( Range, clic #et o.!alues, and then clic Next.

    FG In the ,ispla namebo(, type 'ont( Range.

    VU.1dd the followin$ values by typin$ each in the 4se constant valuebo(, and then clicin$ %ddafter each entry: H, , F, 12, 1I, 2J. 9lic&inis(.

    $reate t(e #tatus Range ,e9nition

    &rocedure ist+ 5nder oan&rocessin$, ri$htclic !ersion 10 @not savedA, and then

    clic %dd New ,e9nition.

    VV.;n the 7elcome to t(e !oca"ular ,e9nition 7i/ardpa$e, clic$onstant !alue+ Range o. !alues+ or #et o. !alues, and then clicNext.

    +**. In the ,e9nition namebo(, type #tatus Range, clic #et o.!alues+and then clic Next.

    +*+. In the ,e9nition tpe list, clic #stem#tring.

    +*). 1dd the followin$ values by typin$ each in the 4se constant valuebo(, and then clicin$ %ddafter each entry: %pproved, ,enied, andPending. 9lic &inis(.

    Pu"lis( t(e LoanProcessing !oca"ular

    &rocedure ist+ In the 6acts #(plorer pane, under the LoanProcessingvocabulary,

    ri$htclic !ersion 10 @not savedA, and then clic #ave.

    (aving the vocabulary saves the denitions to the Business Rule!ngine @atabase# ma?ing them immutable# but the vocabulariesare not available for use until published.

    +*N. "i$htclic !ersion 10, and then clic Pu"lis(.

  • 8/9/2019 Biztalk 2010

    39/52

    !ercise ': )o*(osin& a Business Rule Polic%

    Overview

    1 business rule policy is a collection of rules that are analyzed to mae adecision. In this e(ercise, you will use vocabulary de/nitions to create fourbusiness rules. These rules evaluate a loan application and either approvethe loan or mar it for manual consideration.

    $reate a New Polic

    &rocedure ist+ In &olicy #(plorer, ri$htclic Policies, and then clic %dd New Polic.

    +*P. "ename the policy Loan%pprovalProcess.

    $reate t(e %pproved Rule

    &rocedure ist+ "i$htclic !ersion 10 @not savedA, and then clic %dd New Rule.

    +*Q. "ename the rule %pproved.

    +*R. In the *&pane, ri$htclic $onditions, and then clic %dd logical%N,.

    +*. "i$htclic %N,, point to Predicates, and then clic -reaterT(an.

    +*U. "i$htclic argument1, point to &unctions, and then clic %dd.

    +*V. -ra$ Primar *ncomefrom the 6acts #(plorer pane to value1, andthen dra$ #econdar *ncometo value2.

    ++*. -ra$ Loan %mountfrom the 6acts #(plorer pane to argument2.

    +++. "i$htclic %N,, and then clic %dd logical OR.

    ++). "i$htclic OR, point to Predicates, and then clic-reaterT(anECual.

    ++N. -ra$ Emploment @mont(sAfrom the 6acts #(plorer pane toargument1, and then dra$ 'ont( Rangeto argument2.

    ++P. 9lic 'ont( Range, and then in the dropdown list, clic .

    ++Q. "i$htclic OR, point to Predicates, and then clic-reaterT(anECual.

    ++R. -ra$ Residenc @mont(sAfrom the 6acts #(plorer pane toargument1, and then dra$ 'ont( Rangeto argument2.

    ++. 9lic 'ont( Range, and then in the dropdown list, clic .

    ++U. -ra$ 4pdate Loan #tatusfrom the 6acts #(plorer pane to%ctionsin the T;ENpane.

    ++V. -ra$ #tatus Rangefrom the 6acts #(plorer pane to Kemptstring.

    +)*. 9lic #tatus Range, and then in the dropdown list, clic%pproved.

  • 8/9/2019 Biztalk 2010

    40/52

    $reate t(e ,enied *ncome Rule

    &rocedure ist+ "i$htclic !ersion 10 @not savedA, and then clic %dd New Rule.

    +)+. "ename the rule ,enied *ncome.

    +)). "i$htclic $onditions, point to Predicates, and then clic

    LessT(anECual.

    +)N. "i$htclic argument1, point to &unctions, and then clic %dd.

    +)P. -ra$ Primar *ncomefrom the 6acts #(plorer pane to value1, andthen dra$ #econdar *ncometo value2.

    +)Q. -ra$ Loan %mountfrom the 6acts #(plorer pane to argument2.

    +)R. -ra$ 4pdate Loan #tatusfrom the 6acts #(plorer pane to%ctionsin the T@#' pane.

    +). -ra$ #tatus Rangefrom the 6acts #(plorer pane to Kemptstring.

    +)U. 9lic #tatus Range, and then in the dropdown list, clic Pending.$reate t(e ,enied Residenc and Emploment Rule

    &rocedure ist+ "i$htclic !ersion 10 @not savedA, and then clic %dd New Rule.

    +)V. "ename the rule ,enied Residenc and Emploment.

    +N*. "i$htclic $onditions, and then clic %dd logical %N,.

    +N+. "i$htclic %N,, point to Predicates, and then clic LessT(an.

    +N). -ra$ Emploment @mont(sAfrom the 6acts #(plorer pane toargument1, and then dra$ 'ont( Rangeto argument2.

    +NN. 9lic 'ont( Range, and then in the dropdown list, clic .+NP. "i$htclic %N,, point to Predicates, and then clic LessT(an.

    +NQ. -ra$ Residenc @mont(sAfrom the 6acts #(plorer pane toargument1, and then dra$ 'ont( Rangeto argument2.

    +NR. 9lic 'ont( Range, and then in the dropdown list, clic .

    +N. -ra$ 4pdate Loan #tatusfrom the 6acts #(plorer pane to%ctionsin the T@#' pane.

    +NU. -ra$ #tatus Rangefrom the 6acts #(plorer pane to Kemptstring.

    +NV. 9lic #tatus Range, and then in the dropdown list, clic Pending.

    $reate t(e Loan to #alar Ratio Rule

    &rocedure ist+ "i$htclic !ersion 10 @not savedA, and then clic %dd New Rule.

    +P*. "ename the rule Loan to #alar Ratio.

    +P+. "i$htclic $onditions, point to Predicates, and then clic-reaterT(an.

  • 8/9/2019 Biztalk 2010

    41/52

    +P). -ra$ Loan %mountfrom the 6acts #(plorer pane to argument1,clic argument2, and then type 100.

    +PN. -ra$ #et Loan to *ncome Ratioto %ctionsin the T@#' pane.

    +PP. "i$htclic 0, point to &unctions, and then clic ,ivide.

    +PQ. "i$htclic value1, point to &unctions, and then clic %dd.

    +PR. -ra$ Primar *ncometo value1, and then dra$ #econdar*ncometo value23inside the add function4.

    +P. -ra$ Loan %mountto value2.

    ,eplo and Test t(e Loan%pprovalProcess Polic

    &rocedure ist+ 5nder oan1pproval&rocess, ri$htclic !ersion 10 @not savedA, and

    then clic Pu"lis(.

    +PU. "i$htclic !ersion 10 6 Pu"lis(ed, and then clic ,eplo.

    +PV. In 8indows #(plorer, navi$ate to $:5%ll&iles5La"&iles5La"11, and

    then open BRE6,eniedxml.

    >otice that the loan amount is greater than the income amount#and that the time at residence and the time at employer are boththree months. This loan $ill be denied by the policy you created.

    +Q*. In 8indows #(plorer, open BRE6%pprovedxml.

    >otice that the total income amount is greater than the loanamount# and that the time at residence and at employer are bothgreater than si* months. This loan $ill be approved by the policy

    you created.

    +Q+. 9lose Internet #(plorer.

    +Q). In 8indows #(plorer, copy BRE6,eniedxmland BRE6%pprovedxmlto the La"11folder to create duplicates to use fortestin$ purposes.

    )opies of the messages are important because the Business Rule!ngine $ill permanently change the message.

    +QN. In the Microsoft Business "ule 9omposer, ri$htclic !ersion 10 3,eploed, and then clic Test Polic.

    +QP. In the #elect &actsdialo$ bo(, clic%dv7orsLoan%pprovalLoan%pplication, and then clic %ddinstance.

    +QQ. In the Opendialo$ bo(, navi$ate to $:5%ll&iles5La"&iles5La"11,clic BRE6%pproved 6 $opxml, and then clic Open.

    +QR. In the #elect &actsdialo$ bo(, clic Test.

    +Q. In the Microsoft Business "ule 9omposer, ri$htclic !ersion 10 3,eploed, and then clic Test Polic.

  • 8/9/2019 Biztalk 2010

    42/52

    +QU. In the #elect &actsdialo$ bo(, clic$:55%ll&iles5La"&iles5La"115$op o. BRE6%pprovedxml, and thenclic Remove instance.

    +QV. 9lic %dv7orsLoan%pprovalLoan%pplication, and then clic%dd instance.

    +R*. In the Opendialo$ bo(, navi$ate to $:5%ll&iles5La"&iles5La"11,clic BRE6,enied 6 $opxml, and then clic Open.

    +R+. In the #elect &actsdialo$ bo(, clic Test.

    +R). In 8indows #(plorer, open BRE6%pproved 6 $opxml.

    >otice that the loan status is no$ Approved and that the loan toincome ratio has been calculated.

    +RN. In 8indows #(plorer, open BRE6,enied 6 $opxml.

    >otice that the loan status is no$ Pending# and that the loan%to%income ratio has been calculated.

    +RP. 9lose Internet #(plorer.+RQ. 9lose the Business "ule 9omposer.

  • 8/9/2019 Biztalk 2010

    43/52

    !ercise .: Inte&ratin& a Business Rule Polic% into an "rchestration

    Overview

    BizTal orchestrations use the 9all "ules shape to invoe business rulepolicies. In this e(ercise, you will create a new orchestration that is called bythe &rocess;rderW9redit orchestration. This orchestration calls theoan1pproval&rocess policy and has steps for the manual processin$ of theloans that are not approved by the Business "ule #n$ine. 0ou will then deployand test the application.

    $reate t(e %pproveLoan Orc(estration

    &rocedure ist+ In 8indows #(plorer, navi$ate to

    $:5%ll&iles5La"&iles5La"115%dv7ors, and then doubleclic%dv7orsslnto open the solution.

    +RR. In !olution #(plorer, ri$htclic the Loan%pprovalproject, point to

    %dd, and then clic New *tem.+R. In the %dd New *temdialo$ bo(, clic Orc(estration &iles, in the

    Namebo(, type %pproveLoanodx, and then clic %dd.

    +RU. "i$htclic the %pproveLoanorchestration desi$n surface, clic&roperties 8indow, and in the &roperties window, in the Tpe 'odi9erlist, clic Pu"lic.

    $reate Orc(estration Parameters

    &rocedure ist+ In ;rchestration Ciew, ri$htclic Orc(estration Parameters, and

    then clic New 'essage Parameter.

    +RV. In the Messa$eW+ &roperties window, in the *denti9erbo(, typepar#alesOrder, in the 'essage Tpelist, e(pand #c(emas,andthen clic K#elect .rom re.erenced assem"l.

    +*. In the #elect %rti.act Tpedialo$ bo(, in the left pane, clic%dv7ors'essaging, in the ri$ht pane, clic #alesOrder, and thenclic O.

    ++. In ;rchestration Ciew, ri$htclic Orc(estration Parameters, andthen clic New 'essage Parameter.

    +). In the Messa$eW+ &roperties window, in the *denti9erbo(, typepar&inalLoan, in the ,irection list, clic Out,in the 'essage Tpe

    list e(pand #c(emas,and then clic%dv7orsLoan%pproval&inalLoan,ocument.

    $reate 'essages

    &rocedure ist+ In ;rchestration Ciew, ri$htclic 'essages, and then clic New

    'essage.

  • 8/9/2019 Biztalk 2010

    44/52

    +N. In the Messa$eW+ &roperties window, in the *denti9erbo(, typemsg*nterimLoan, in the 'essage Tpelist, e(pand #c(emas,andthen clic %dv7orsLoan%pproval&inalLoan,ocument.

    +P. In ;rchestration Ciew, ri$htclic 'essages, and then clic New'essage.

    +Q. In the Messa$eW+ &roperties window, in the *denti9erbo(, typemsgLoan%pp, in the 'essage Tpelist, e(pand #c(emas,and thenclic %dv7orsLoan%pprovalLoan%pplication.

    $reate a $orrelation Tpe

    &rocedure ist+ In ;rchestration Ciew, e(pand Tpes, ri$htclic $orrelation Tpes,

    and then clic New $orrelation Tpe.

    +R. In the $orrelation Propertiesdialo$ bo(, in the left pane, e(pand%dv7orsLoan%pprovalPropert#c(ema, clic %mount, clic%dd, clic $ustomer, clic %dd, and then clic O.

    +. In the 9orrelationTypeW+ &roperties window, in the *denti9erbo(,type 'anual%pproval$orrTpe.

    $reate a $orrelation #et

    &rocedure ist+ In ;rchestration Ciew, ri$htclic $orrelation #ets, and then clic

    New $orrelation #et.

    +U. In the 9orrelationW+ &roperties window, in the *denti9erbo(, type'anual%pproval$orr#et, and then in the $orrelation Tpelist,clic %dv7orsLoan%pproval'anual%pproval$orrTpe .

    %dd a Trans.orm #(ape

    &rocedure ist+ "i$htclic ,rop a s(ape .rom t(e tool"ox (ere, point to *nsert

    #(ape, and then clic Trans.orm.

    +V. 9on/$ure the construct messa$e and transform shapes with theproperties shown in the followin$ table.

    $onstruct 'essage #(ape

    Propert !alue

    'ame 9onstruct ms$oan1pp

    Messa$es 9onstructed ms$oan1pp

    Trans.orm #(ape

    Propert !alue

    'ame Map to oan1pp

    Map 'ame 3#(istin$ Map4 1dv8ors.oan1pproval.!ales;rderWToW

  • 8/9/2019 Biztalk 2010

    45/52

  • 8/9/2019 Biztalk 2010

    46/52

    Trans.orm #(ape

    Propert !alue

    'ame Map to 6inaloan

    Map 'ame 3#(istin$Map4

    1dv8ors.oan1pproval.!ales;rderWToW6inaloan

    Map !ource par!ales;rder

    Map -estination par6inaloan

    'essage %ssignment #(ape

    Propert !alue

    'ame 1dd oan &roperties

    +UR. In the messa$e assi$nment shape &roperties window, in theExpressionbo(, clic the clic the ellipsis3M4 button, type thefollowin$ e(pression 3four separate lines4 in the BizTal #(pression#ditor window, and then clic O.

    par6inaloan.oan.1mount ? ms$oan1pp.oan9onditions.oan1mountpar6inaloan.oan.oanToIncome"atio ?

    ms$oan1pp.oan9onditions.oanToIncomepar6inaloan.oan.!tatus ? ms$oan1pp.oan9onditions.oan!tatuspar6inaloan.oan.Term ? ms$oan1pp.oan9onditions.Term

    %dd #(apes to t(e Else Branc( o. t(e ,ecide #(ape

    &rocedure ist+ "i$htclic the $onstruct par&inalLoanconstruct shape, and then

    clic $op.

    +U. Below the Elsebranch of the decide shape, ri$htclic ,rop as(ape .rom t(e tool"ox (ere, and then clic Paste.

    +UU. 9han$e the con/$uration to the $onstruct 'essage, Trans.orm,and 'essage %ssignment shapes to represent the followin$ table.

    $onstruct 'essage #(ape

    Propert !alue

    'ame 9onstruct ms$Interimoan

    Messa$e 9onstructed ms$Interimoan

    Trans.orm #(ape

  • 8/9/2019 Biztalk 2010

    47/52

    Propert !alue

    'ame Map to 6inaloan

    Map 'ame 3#(istin$Map4

    1dv8ors.oan1pproval.!ales;rderWToW6inaloan

    Map !ource par!ales;rder

    Map -estination ms$Interimoan

    'essage %ssignment #(ape

    Propert !alue

    'ame 1dd oan &roperties

    +UV. 9han$e the Expressionin the %dd Loan Propertiesshape below

    the Elsebranch to the followin$ e(pression 3four lines4.

    ms$Interimoan.oan.1mount?ms$oan1pp.oan9onditions.oan1mountms$Interimoan.oan.oanToIncome"atio ?

    ms$oan1pp.oan9onditions.oanToIncomems$Interimoan.oan.!tatus?ms$oan1pp.oan9onditions.oan!tatus

    ms$Interimoan.oan.Term?ms$oan1pp.oan9onditions.Term

    +V*. "i$htclic below the construct messa$eshape in the Elsebranch,point to *nsert #(ape, and then clic #end.

    +V+. "i$htclic below the sendshape in the Elsebranch, point to *nsert

    #(ape, and then clic Receive.

    +V). 9on/$ure the #end and Receive shapes as shown in the followin$table.

    #end #(ape

    Propert !alue

    Initializin$9orrelation !et

    Manual1pproval9orr!et

    Messa$e ms$Interimoan

    'ame !hare&oint &rocessin$

    Receive #(ape

    Propert !alue

    6ollowin$9orrelation !et

    Manual1pproval9orr!et

  • 8/9/2019 Biztalk 2010

    48/52

    Messa$e par6inaloan

    'ame !hare&oint &rocessin$

    %dd Orc(estration Ports&rocedure ist

    + "i$htclic the ri$ht &ort !urface, and then clic New $on9guredPort.

    +VN. 9on/$ure the port as shown in the followin$ table.

    Propert !alue

    'ame !hare&oint"e%

    &ort Type 'ame 3new &ortType4

    !hare&ointType

    -irection !end

    Bindin$ !pecify later

    +VP. "i$htclic the ri$ht &ort !urface, and then clic New $on9guredPort.

    +VQ. 9on/$ure the port as shown in the followin$ table.

    Propert !alue

    'ame !hare&oint"esp

    &ort Type 'ame 3e(istin$ &ortType4

    !hare&ointType

    -irection "eceive

    Bindin$ !pecify later

    +VR. 9onnect the #end shape to the #(arePointReCport, and thenconnect the Receive shape to the #(arePointRespport.

    +V. In !olution #(plorer, ri$htclic the %dv7ors solution, and thenclic Build #olution.

    $on9gure t(e ProcessOrder$redit Orc(estration to call t(e %pproveLoanOrc(estration

    &rocedure ist

  • 8/9/2019 Biztalk 2010

    49/52

    + In !olution #(plorer, under Processes, doubleclicProcessOrder$reditodxto open the orchestration.

    +VU. In the ProcessOrderorchestration, delete the $onstructmsg&inalLoanconstruct shape 3includin$ the 'ap to Loan &inaltransform shape4.

    +VV. "i$htclic the arrow below the Receive $redit #Oreceive shape,point to *nsert #(ape, and then clic $all Orc(estration.

    )**. In the &roperties window, in the Name bo(, type %pprove Loan,and then in the $alled Orc(estrationlist, clic K#elect .rom are.erenced assem"l.

    )*+. In the #elect %rti.act Tpedialo$ bo(, in the left pane, e(pand%dv7orsLoan%pproval, in the ri$ht pane, clic %pproveLoan, andthen clic O.

    )*). In the 9all ;rchestration &roperties window, clic the ellipsis3M4button in the Parametersbo(.

    The parameters are automatically congured for you.)*N. 9lic O.

    %dd a ,ecide #(ape

    &rocedure ist+ "i$htclic the arrow below the %pprove Loancall orchestration

    shape, point to *nsert #(ape, and then clic ,ecide.

    )*P. "ename the decide shape to *s Loan %pproved, and then clicthe Rule1branch.

    )*Q. In the &roperties window, in the Name bo(, type %pproved, andthen clic the ellipsis3M4 button in the Expressionbo(.

    )*R. In the BizTal #(pression #ditor window, type the followin$e(pression, and then clic O.

    ms$6inaloan.oan.!tatus??Y1pprovedY

    )*. -ra$ a #endshape from the Toolbo( to the Elsebranch of the *sLoan %pproveddecide shape.

    )*U. In the &roperties window, in the Name bo(, type Loan ,enial, andthen in the 'essagelist, clic msg#alesOrder.

    )*V. -ra$ the Loan approved so several t(ings need to "e done

    $roup shape to the %pprovedbranch of the *s Loan %pproveddecide shape.

    $on9gure a #end Port

    &rocedure ist+ "i$htclic the ri$ht &ort !urface, and then clic New $on9gured

    Port.

    )+*. 9on/$ure the port as shown in the followin$ table.

  • 8/9/2019 Biztalk 2010

    50/52

    Propert Calue

    'ame oan-enial

    &ort Type 'ame 3new &ortType4

    oan-enialType

    -irection !end

    Bindin$ !pecify later

    )++. 9onnect the Loan ,enialsend shape to the Loan,enialsendport.

    )+). In 8indows #(plorer, navi$ate to $:5%ll&iles5La"&iles5La"11, andthen open ProcessOrder$reditpng.

    our Process"rder)redit orchestration should loo? similar to the

    one sho$n in this picture.)+N. 9lose &rocess;rderW9redit.pn$.

    Build and ,eplo t(e #olution

    &rocedure ist+ In !olution #(plorer, ri$htclic the %dv7orssolution, and then clic

    Build #olution.

    )+P. In !olution #(plorer, ri$htclic the %dv7orssolution, and thenclic ,eplo #olution.

    $on9gure Port Bindings

    &rocedure ist+ ;n the #tartmenu, clic %ll Programs, clic 'icroso.t Bi/Tal

    #erver 2010, and then clic Bi/Tal #erver %dministration.

    )+Q. In the BizTal 1dministration 9onsole, e(pand Bi/Tal #erver%dministration, Bi/Tal -roup, %pplications, and %dventure7ors.

    )+R. "i$htclic %dventure 7ors, and then clic $on9gure.

    )+. In the $on9gure %pplicationdialo$ bo(, clic %pproveLoan.

    >one of the ports are bound.

    )+U. In the $on9gure %pplicationdialo$ bo(, clicProcessOrder$redit.

    The ne$ oan@enial port is not bound.

    )+V. 9lic O.

    ))*. "i$htclic the %dventure 7orsapplication, point to *mport, andthen clic Bindings.

  • 8/9/2019 Biztalk 2010

    51/52

    ))+. In the *mport Bindingsdialo$ bo(, navi$ate to$:5%ll&iles5La"&iles5La"11, and then doubleclicLa"11Bindingsxml.

    Test t(e %pplication

    &rocedure ist+ To e(tend the e(piration period of the Microsoft ;Ece installation on

    this virtual machine, in 8indows #(plorer, navi$ate to $:5%ll&ilesanddoubleclic extendcmd

    ) In the BizTal !erver 1dministration 9onsole, ri$htclic the %dventure7ors application, and then clic #tart.

    N In the #tart %dventure 7orsQ %pplicationdialo$ bo(, clic #tart.

    ))). In 8indows #(plorer, navi$ate to $:5%ll&iles5La"&iles5La"11, andthen open $red#alesOrder6%pproved1xml.

    All loans greater than or e;ual to &''' are sent to 8oodgroveBan?# all other loans $ill be handled by the Adventure 8or?s

    nancial department. This order meets all of the conditions to beapproved by the business rule policy. The number of months atresidence and months employed are both greater than 3# and thetotal amount of monthly income is greater than the total amount ofthe order.

    ))N. 9lose Microsoft Info&ath.

    ))P. 9opy $red#alesOrder6%pproved1xml to the #alesOrder*Nfolder.

    ))Q. ;pen the O4Tfolder.

    There are three messagesC the notication that goes to 8oodgrove

    Ban?# the completed message# and the restoc? message.))R. -elete the three messa$es.

    )). In 8indows #(plorer, navi$ate to $:5%ll&iles5La"&iles5La"11, andthen open $red#alesOrder6*nternal1xml.

    This order meets all of the conditions to be approved by thebusiness rule policy. The number of months at residence andmonths employed are both greater than 3# and the total amount ofmonthly income is greater than the total amount of the order.=o$ever# it $ill be processed diDerently from the rst order1 thisone $ill not be sent to 8oodgrove Ban?. Instead# it $ill be handledby the Adventure 8or?s nancial department.

    ))U. 9lose Info&ath.

    ))V. 9opy $red#alesOrder6*nternal1xml to the #alesOrder*Nfolder.

    )N*. ;pen the O4Tfolder.

    >otice the completed message and the restoc? message.

    )N+. -elete the two messa$es.

  • 8/9/2019 Biztalk 2010

    52/52

    )N). In 8indows #(plorer, navi$ate to $:5%ll&iles5La"&iles5La"11, andthen open $red#alesOrder6,enied1xml.

    This order does not meet the residency and employmentconditions. The order $ill not be approved and $ill re;uire manual

    processing in order to approve or deny the loan.

    )NN. 9lose Info&ath.

    )NP. 9opy $red#alesOrder6,enied1xmlto the #alesOrder*Nfolder.

    )NQ. ;pen the O4Tfolder.

    )NR. There are no new messa$es.

    2HG In Internet #(plorer, navi$ate to(ttp:local(ostLoan%pplications, and then open the messa$e inInfo&ath.

    2HI In the #tatuslist of the loan application, clic %pproved, and thenclose the form, savin$ your chan$es.

    2HF "efresh the pa$e, and notice that the messa$e has been piced upfor processin$.

    2J0 In 8indows #(plorer, navi$ate to $:5%ll&iles5La"&iles5La"115O4T,and notice the three messa$es.

    2J1 In 8indows #(plorer, navi$ate to $:5%ll&iles5La"&iles5La"11, andthen copy $red#alesOrder6,enied1xmlto the #alesOrder*nfolder.

    2J2 In Internet #(plorer, navi$ate to(ttp:local(ostLoan%pplications&orms%ll*temsaspx, and thenopen the messa$e in Info&ath.

    2JH In the #tatuslist of the loan application, clic ,enied, and then

    close the form, savin$ your chan$es.

    2JJ "efresh the pa$e, and notice that the messa$e has been piced upfor processin$.

    )PQ. In 8indows #(plorer, navi$ate to $:5%ll&iles5La"&iles5La"115O4T,and notice the denial messa$e.