%3CLINGO-SUB%20id%3D%22lingo-sub-1623499%22%20slang%3D%22en-US%22%3EUsing%20BizTalk%20maps%20which%20leverage%20external%20assemblies%20in%20Logic%20Apps%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1623499%22%20slang%3D%22en-US%22%3E%3CP%3E%3CFONT%20size%3D%227%22%3EOverview%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EMicrosoft%20BizTalk%20Server%20is%20a%20rich%20and%20robust%20integration%20platform%20and%20is%20nearing%20its%20twentieth%20birthday(!).%26nbsp%3B%20Hundreds%2C%20if%20not%20thousands%2C%20of%20customers%20have%20made%20significant%20investments%20over%20the%20years%20developing%20their%20integration%20solutions%20on%20BizTalk%20Server.%26nbsp%3B%20As%20they%20move%20workloads%20to%20Azure%20to%20either%20run%20both%20in%20conjunction%20with%20BizTalk%20Server%20and%20within%20Azure%20natively%2C%20they%20would%20like%20to%20be%20able%20to%20leverage%20those%20investments%20with%20minimal%20refactoring.%3CBR%20%2F%3E%3CBR%20%2F%3EAzure%20Logic%20Apps%20is%20an%20integration%20cloud%20service%20which%20allows%20users%20to%26nbsp%3B%3CSPAN%3Eschedule%2C%20automate%2C%20and%20orchestrate%20tasks%2C%20business%20processes%2C%20and%20workflows.%26nbsp%3B%20Logic%20Apps%20functionality%20both%20overlaps%20and%20complements%20functionality%20in%20BizTalk%2C%20but%20quite%20helpfully%2C%20it%20also%20allows%20for%20the%20reuse%20of%20existing%20BizTalk%20artifacts%2C%20such%20as%20schemas%20and%20maps.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBizTalk%20maps%20transform%20messages%20between%20different%20schemas%2C%20and%20use%20a%20number%20of%20tools%20within%20the%20map%20to%20manipulate%20data%20during%20the%20transformation.%26nbsp%3B%20The%20maps%20can%20also%20utilize%20external%20.NET%20assemblies%20for%20these%20transformations%2C%20but%20because%20of%20how%20BizTalk%20references%20these%20assemblies%20natively%2C%20the%20maps%20need%20some%20changes%20in%20order%20to%20be%20able%20to%20reference%20those%20assemblies%20when%20run%20in%20Logic%20Apps.%26nbsp%3B%20This%20article%20shows%20how%20to%20edit%20a%20map%20created%20in%20BizTalk%20to%20utilize%20external%20assemblies%20when%20run%20in%20Logic%20Apps.%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%227%22%3EScenario%3C%2FFONT%3E%3CBR%20%2F%3EFor%20the%20purpose%20of%20this%20blog%2C%20we%20will%20setup%20a%20small%20solution%20consisting%20of%20two%20schemas%2C%20a%20BizTalk%20map%2C%20as%20well%20as%20an%20external%20.NET%20assembly.%26nbsp%3B%20The%20full%20solution%20of%20BizTalk%20artifacts%20and%20sample%20files%20is%20available%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjftl6y%2FBizTalkMapWithAssemblyReference%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere.%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20scenario%2C%20we%20have%20two%20sample%20schemas%3A%20Foo%2C%20representing%20our%20source%20schema%2C%20and%20Bar%2C%20representing%20the%20target.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JohnScott_0-1598897409311.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215644i403E6165D24312A9%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22JohnScott_0-1598897409311.png%22%20alt%3D%22JohnScott_0-1598897409311.png%22%20%2F%3E%3C%2FSPAN%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JohnScott_1-1598897445015.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215645i95F417CDEEE35B82%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22JohnScott_1-1598897445015.png%22%20alt%3D%22JohnScott_1-1598897445015.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWe%20also%20have%20a%20.NET%20Framework%20class%20library%2C%20called%20MapperAssemblies%2C%20which%20contains%20a%20small%20class%20with%20two%20trivial%20methods%3A%26nbsp%3B%20AddTodayToValue%2C%20which%20will%20simply%20append%20today's%20day%20of%20the%20week%20value%20to%20the%20input%20value%2C%20and%20ConcatValues%2C%20which%20concatenates%20the%20input%20values.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Eusing%20System%3B%0A%0Anamespace%20MapperAssemblies%0A%7B%0A%20%20%20%20public%20class%20TransformValues%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20public%20string%20AddTodayToValue(string%20input)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20%24%22%7Binput%7D%20today%20is%20%7BDateTime.Now.DayOfWeek.ToString()%7D%22%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20public%20string%20ConcatValues(string%20val1%2C%20string%20val2)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20string.Concat(val1%2C%20val2)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20per%20most%20libraries%20used%20in%20BizTalk%2C%20this%20assembly%20has%20been%20signed%20and%20added%20to%20the%20global%20assembly%20cache%20(GAC).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFinally%2C%20we%20have%20the%20map%3A%26nbsp%3B%20This%20map%20performs%20a%20simple%20transform%20of%20the%20incoming%20two%20values%20from%20Foo%20to%20the%20three%20values%20in%20Bar.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JohnScott_2-1598897691438.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215646i5766BF3A5DAAFD57%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22JohnScott_2-1598897691438.png%22%20alt%3D%22JohnScott_2-1598897691438.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EEach%20of%20the%20three%20functoids%20pictured%20is%20referencing%20the%20sample%20assembly%20code%2C%20for%20exmple%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JohnScott_3-1598897764206.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215647i4C46A9B47AEBDEC8%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22JohnScott_3-1598897764206.png%22%20alt%3D%22JohnScott_3-1598897764206.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ETesting%20the%20map%20with%20the%20following%20sample%20input%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3E%3CFOO%20ns0%3D%22http%3A%2F%2FMapWithAssmeblyReference.FooSchema%22%3E%0A%20%20%3CVAL1%3EValue%201%3C%2FVAL1%3E%0A%20%20%3CVAL2%3EValue%202%3C%2FVAL2%3E%0A%3C%2FFOO%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWill%20yield%20the%20following%20output%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3E%3CBAR%20ns0%3D%22http%3A%2F%2FMapWithAssmeblyReference.BarSchema%22%3E%0A%20%20%20%20%3CVAL1%3EValue%201%20today%20is%20Monday%3C%2FVAL1%3E%0A%20%20%20%20%3CVAL2%3EValue%202%20today%20is%20Monday%3C%2FVAL2%3E%0A%20%20%20%20%3CVAL1VAL2%3EValue%201Value%202%3C%2FVAL1VAL2%3E%0A%3C%2FBAR%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%226%22%3EAdding%20the%20artifacts%20to%20Logic%20Apps%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIn%20order%20to%20utilize%20the%20BizTalk%20artifacts%20in%20Logic%20Apps%2C%20the%20artifacts%20must%20be%20stored%20to%20an%20Integration%20Account%20in%20Azure.%26nbsp%3B%20Integration%20Accounts%20are%20a%20companion%20resource%20to%20Logic%20Apps%20in%20Azure%2C%20and%20can%20be%20used%20as%20a%20container%20to%20store%20integration%20artifacts%20such%20as%20maps%2C%20schemas%20and%20assemblies%2C%20as%20well%20as%20certificates%20and%20trading%20partner%20agreements.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3ECreate%20the%20Integration%20Account%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EInformation%20on%20creating%20an%20Integration%20Account%20is%20documented%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Flogic-apps%2Flogic-apps-enterprise-integration-create-integration-account%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere.%3C%2FA%3E%26nbsp%3BFor%20the%20purpose%20of%20this%20sample%2C%20the%20free%20tier%20for%20the%20Integration%20Account%20is%20adequate.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EAdding%20Schemas%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EFor%20both%20the%20Foo%20and%20Bar%20schemas%2C%20perform%20the%20following%20steps%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EOpen%20the%20Integration%20Account%3C%2FLI%3E%0A%3CLI%3EClick%20on%20Schemas%20under%20Settings%3C%2FLI%3E%0A%3CLI%3EClick%20on%20%2B%20Add%3C%2FLI%3E%0A%3CLI%3ESelect%20%22Small%20File%22%20and%20click%20the%20file%20icon%20and%20navigate%20to%20the%20XSD%20in%20your%20BizTalk%20solution.%26nbsp%3B%20The%20schema%20name%20will%20auto-populate.%3C%2FLI%3E%0A%3CLI%3EClick%20%22OK%22%20to%20add%20the%20schema%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EAdding%20the%20map%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EThis%20step%20is%20not%20quite%20as%20intuitive%20as%20adding%20the%20schemas%20because%20BizTalk%20maps%20files%20(btm)%20are%20not%20natively%20supported%20by%20Logic%20Apps.%26nbsp%3B%20However%2C%20as%20BizTalk%20files%20compile%20to%20XSLT%2C%20the%20output%20XSLT%20can%20be%20loaded%20to%20the%20Integration%20Account.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EOpen%20Visual%20Studio%20and%20open%20your%20BizTalk%20map%20file.%3C%2FLI%3E%0A%3CLI%3ERight-click%20the%20BizTalk%20map%20file%20in%20Solution%20Explorer%2C%20and%20select%20%22Validate%20Map%22%3C%2FLI%3E%0A%3CLI%3EIn%20the%20Output%20window%20for%20BizTalk%20output%2C%20there%20will%20be%20a%20link%20to%20the%20output%20XSLT.%26nbsp%3B%20Copy%20this%20file%20location.%3C%2FLI%3E%0A%3CLI%3EIn%20the%20Azure%20portal%2C%20open%20the%20Integration%20Account%3C%2FLI%3E%0A%3CLI%3EClick%20on%20Maps%20under%20Settings%3C%2FLI%3E%0A%3CLI%3EClick%20on%20%2B%20Add%3C%2FLI%3E%0A%3CLI%3ELeave%20the%20Map%20Type%20as%20XSLT%3C%2FLI%3E%0A%3CLI%3EClick%20the%20file%20icon%20and%20navigate%20to%20the%20XSLT%20path%20from%20the%20%22Validate%20Map%22%20step%20about.%26nbsp%3B%20The%20map%20name%20will%20auto-populate.%3C%2FLI%3E%0A%3CLI%3EClick%20%22OK%22%20to%20add%20the%20map%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EAdding%20the%20Assembly%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIn%20the%20Azure%20portal%2C%20open%20the%20Integration%20Account%3C%2FLI%3E%0A%3CLI%3EClick%20on%20Assemblies%20under%20Settings%3C%2FLI%3E%0A%3CLI%3EClick%20on%20%2B%20Add%3C%2FLI%3E%0A%3CLI%3EClick%20the%20file%20icon%20and%20navigate%20to%20the%20DLL%20for%20your%20assembly.%26nbsp%3B%20The%20assembly%20name%20will%20auto-populate.%0A%3CUL%3E%0A%3CLI%3ENote%3A%26nbsp%3B%20For%20DLLs%20larger%20than%202%20MB%2C%20select%20the%20%22Large%20File%22%20option.%26nbsp%3B%20This%20will%20require%20you%20to%20first%20upload%20your%20DLL%20to%20Azure%20Storage%20and%20provide%20the%20URI%20to%20the%20file.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EClick%20%22OK%22%20to%20add%20the%20assembly%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%20size%3D%226%22%3EAdding%20the%20Logic%20App%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EWhile%20there%20are%20many%20ways%20to%20trigger%20and%20test%20the%20logic%20app%2C%20in%20this%20scenario%20we%20will%20create%20a%20simple%20Logic%20App%20with%20an%20HTTP%20Trigger%20and%20use%20Postman%20to%20test%20the%20Logic%20App.%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3ECreate%20the%20Logic%20App%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIn%20the%20Azure%20portal%2C%20click%20%22%2B%20Create%20a%20resource%22%20and%20enter%20Logic%20App%20into%20the%20search.%26nbsp%3B%20Select%20%22Logic%20App%22%20and%20follow%20the%20wizard%20to%20create%20a%20new%20Logic%20App.%3C%2FLI%3E%0A%3CLI%3ENavigate%20to%20the%20newly%20created%20Logic%20App%20and%20select%20Workflow%20settings%20under%20Settings%3C%2FLI%3E%0A%3CLI%3EUnder%20%22Integration%20account%22%20select%20the%20integration%20account%20created%20in%20the%20initial%20step.%26nbsp%3B%20Click%20Save%20to%20save%20the%20changes.%3C%2FLI%3E%0A%3CLI%3EClick%20Logic%20app%20designer%20under%20Development%20Tools%3C%2FLI%3E%0A%3CLI%3EThis%20test%20will%20create%20a%20simple%20Logic%20App%20with%20four%20(4)%20steps%3A%0A%3CUL%3E%0A%3CLI%3ESet%20the%20initial%20trigger%20to%20%22HTTP%20request%22.%26nbsp%3B%20Do%20not%20change%20any%20settings%20on%20this%20step.%3C%2FLI%3E%0A%3CLI%3EAdd%20a%20XML%20Validation%20step%20to%20the%20Logic%20App%20after%20the%20HTTP%20request%20trigger.%26nbsp%3B%20The%20Content%20will%20be%20the%20value%20of%20the%20Body%20from%20the%20HTTP%20request.%26nbsp%3B%20Add%20the%20%22Foo%20schema%20for%20the%20schema%20name.%3C%2FLI%3E%0A%3CLI%3EAdd%20a%20Transform%20XML%20step%20to%20the%20Logic%20App%20after%20the%20XML%20Validation%20step.%26nbsp%3B%20The%20Content%20will%20be%20the%20value%20of%20the%20Body%20from%20the%20HTTP%20request%20and%20the%20map%20will%20be%20the%20Foo-2-Bar%20map%20imported%20to%20the%20Integration%20Account.%3C%2FLI%3E%0A%3CLI%3EAdd%20a%20Response%20step%20to%20the%20Logic%20App%20after%20the%20Transform%20XML%20step.%26nbsp%3B%20The%20body%20will%20be%20the%20Transformed%20XML%20from%20the%20Transform%20step.%3C%2FLI%3E%0A%3CLI%3ESave%20the%20Logic%20App%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JohnScott_0-1598910771297.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215702i34AF460060CDBC14%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22JohnScott_0-1598910771297.png%22%20alt%3D%22JohnScott_0-1598910771297.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3ETesting%20the%20Logic%20App%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EThis%20scenario%20will%20use%20Postman%20to%20test%20the%20Logic%20App%2C%20but%20any%20equivalent%20tool%20can%20be%20used.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAfter%20saving%20the%20Logic%20App%2C%20the%20HTTP%20POST%20URL%20will%20be%20displayed.%26nbsp%3B%20Copy%20this%20URL%20to%20Postman%20and%20set%20the%20request%20type%20to%20%22POST%22%3C%2FLI%3E%0A%3CLI%3EIn%20the%20request%20body%2C%20use%20the%20sample%20used%20previously%20to%20test%20the%20map%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3E%3CFOO%20ns0%3D%22http%3A%2F%2FMapWithAssmeblyReference.FooSchema%22%3E%0A%20%20%3CVAL1%3EValue%201%3C%2FVAL1%3E%0A%20%20%3CVAL2%3EValue%202%3C%2FVAL2%3E%0A%3C%2FFOO%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EClick%20%22Send%22%20to%20submit%20the%20POST%20to%20Logic%20Apps.%3C%2FLI%3E%0A%3CLI%3EIn%20the%20Azure%20portal%2C%20click%20the%20%22Overview%22%20link%20and%20view%20the%20Runs%20history.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ELooking%20at%20the%20%22Runs%22%20history%20will%20display%20an%20error%20in%20the%20Transform%20XML%20step.%26nbsp%3B%20The%20specific%20error%20will%20be%20similar%20to%20the%20following%3A%3CBR%20%2F%3E%22Code%22%3A%20%22Invalid%20XsltContent%22%2C%3CBR%20%2F%3E%22Message%22%3A%20%22An%20error%20occured%20while%20processing%20map.%20'Cannot%20find%20a%20script%20or%20an%20extension%20object%20associated%20with%20namespace%20'%3CA%20href%3D%22http%3A%2F%2Fschemas.microsoft.com%2FBizTalk%2F2003%2FScriptNS0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fschemas.microsoft.com%2FBizTalk%2F2003%2FScriptNS0%3C%2FA%3E'.'%22%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JohnScott_1-1598912454341.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215705iF46E4DF1075FCB42%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22JohnScott_1-1598912454341.png%22%20alt%3D%22JohnScott_1-1598912454341.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CFONT%20size%3D%225%22%3EUnderstanding%20the%20error%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3ELooking%20inside%20the%20XSLT%20generated%20by%20the%20BizTalk%20map%20will%20show%20us%20the%20source%20of%20the%20error.%26nbsp%3B%20When%20BizTalk%20generates%20the%20XSLT%2C%20it%20leaves%20a%20namespace%20reference%20to%20the%20assembly%20(ScriptNS0)%2C%20but%20does%20not%20explicitly%20reference%20the%20assembly%2C%20which%20causes%20Logic%20Apps%20to%20throw%20the%20error%20as%20it%20does%20not%20know%20which%20assembly%20to%20associate%20with%20this.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3E%0A%3CSTYLESHEET%20xsl%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2FXSL%2FTransform%22%20msxsl%3D%22urn%3Aschemas-microsoft-com%3Axslt%22%20var%3D%22http%3A%2F%2Fschemas.microsoft.com%2FBizTalk%2F2003%2Fvar%22%20exclude-result-prefixes%3D%22msxsl%20var%20s0%20ScriptNS0%22%20version%3D%221.0%22%20ns0%3D%22http%3A%2F%2FMapWithAssmeblyReference.BarSchema%22%20s0%3D%22http%3A%2F%2FMapWithAssmeblyReference.FooSchema%22%20scriptns0%3D%22http%3A%2F%2Fschemas.microsoft.com%2FBizTalk%2F2003%2FScriptNS0%22%3E%0A%20%20%3COUTPUT%20omit-xml-declaration%3D%22yes%22%20method%3D%22xml%22%20version%3D%221.0%22%3E%3C%2FOUTPUT%3E%0A%20%20%3CTEMPLATE%20match%3D%22%2F%22%3E%0A%20%20%20%20%3CAPPLY-TEMPLATES%20select%3D%22%2Fs0%3AFoo%22%3E%3C%2FAPPLY-TEMPLATES%3E%0A%20%20%3C%2FTEMPLATE%3E%0A%20%20%3CTEMPLATE%20match%3D%22%2Fs0%3AFoo%22%3E%0A%20%20%20%20%3CVARIABLE%20name%3D%22var%3Av3%22%20select%3D%22string(Val1%2Ftext())%22%3E%3C%2FVARIABLE%3E%0A%20%20%20%20%3CVARIABLE%20name%3D%22var%3Av4%22%20select%3D%22string(Val2%2Ftext())%22%3E%3C%2FVARIABLE%3E%0A%20%20%20%20%3CBAR%3E%0A%20%20%20%20%20%20%3CVARIABLE%20name%3D%22var%3Av1%22%20select%3D%22ScriptNS0%3AAddTodayToValue(string(Val1%2Ftext()))%22%3E%3C%2FVARIABLE%3E%0A%20%20%20%20%20%20%3CVAL1%3E%0A%20%20%20%20%20%20%20%20%3CVALUE-OF%20select%3D%22%24var%3Av1%22%3E%3C%2FVALUE-OF%3E%0A%20%20%20%20%20%20%3C%2FVAL1%3E%0A%20%20%20%20%20%20%3CVARIABLE%20name%3D%22var%3Av2%22%20select%3D%22ScriptNS0%3AAddTodayToValue(string(Val2%2Ftext()))%22%3E%3C%2FVARIABLE%3E%0A%20%20%20%20%20%20%3CVAL2%3E%0A%20%20%20%20%20%20%20%20%3CVALUE-OF%20select%3D%22%24var%3Av2%22%3E%3C%2FVALUE-OF%3E%0A%20%20%20%20%20%20%3C%2FVAL2%3E%0A%20%20%20%20%20%20%3CVARIABLE%20name%3D%22var%3Av5%22%20select%3D%22ScriptNS0%3AConcatValues(%24var%3Av3%20%2C%20%24var%3Av4)%22%3E%3C%2FVARIABLE%3E%0A%20%20%20%20%20%20%3CVAL1VAL2%3E%0A%20%20%20%20%20%20%20%20%3CVALUE-OF%20select%3D%22%24var%3Av5%22%3E%3C%2FVALUE-OF%3E%0A%20%20%20%20%20%20%3C%2FVAL1VAL2%3E%0A%20%20%20%20%3C%2FBAR%3E%0A%20%20%3C%2FTEMPLATE%3E%0A%3C%2FSTYLESHEET%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CFONT%20size%3D%225%22%3EFixing%20the%20error%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIn%20order%20to%20tell%20Logic%20Apps%20how%20to%20associate%20this%20reference%20with%20the%20uploaded%20assembly%2C%20we%20need%20to%20tweak%20the%20XSLT.%26nbsp%3B%20To%20do%20this%20we%20will%20need%20to%20know%20the%20assembly%20details%2C%20the%20name%20of%20the%20namespace%20for%20the%20helper%20class%2C%20as%20well%20as%20the%20class%20name%20and%20method%20signatures%20of%20all%20referenced%20methods.%3C%2FP%3E%0A%3CP%3EAs%20shown%20in%20the%20sample%20below%2C%20we%20will%20add%20an%20msxsl%3Ascript%20element%20to%20the%20generated%20XSL%20which%20will%20help%20Logic%20Apps%20associate%20the%20script%20with%20the%20assembly.%26nbsp%3B%20The%20key%20parts%20to%20the%20element%20are%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20implements-prefix%20attribute%20indicates%20which%20xmlns%20to%20associate%20(e.g.%20ScriptNS0).%3C%2FLI%3E%0A%3CLI%3EThe%20msxsl%3Aassembly%20element%20gives%20the%20assembly%20information%2C%20including%20name%2C%20version%2C%20Culture%20and%20PublicKeyToken.%3C%2FLI%3E%0A%3CLI%3Emsxsl%3Ausing%20namespace%20attribute%20indicates%20which%20namespace%20within%20the%20assembly%20is%20being%20referenced.%3C%2FLI%3E%0A%3CLI%3EOne%20CDATA%20block%20for%20each%20method%20being%20referenced%20in%20the%20mapper.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EFor%20this%20example%2C%20the%20modified%20XSLT%20will%20look%20like%20this%20(note%20the%20msxsl%3Ascript%20element)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3E%0A%3CSTYLESHEET%20xsl%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2FXSL%2FTransform%22%20msxsl%3D%22urn%3Aschemas-microsoft-com%3Axslt%22%20var%3D%22http%3A%2F%2Fschemas.microsoft.com%2FBizTalk%2F2003%2Fvar%22%20exclude-result-prefixes%3D%22msxsl%20var%20s0%20ScriptNS0%22%20version%3D%221.0%22%20ns0%3D%22http%3A%2F%2FMapWithAssmeblyReference.BarSchema%22%20s0%3D%22http%3A%2F%2FMapWithAssmeblyReference.FooSchema%22%20scriptns0%3D%22http%3A%2F%2Fschemas.microsoft.com%2FBizTalk%2F2003%2FScriptNS0%22%3E%0A%20%3CSCRIPT%20language%3D%22C%23%22%20implements-prefix%3D%22ScriptNS0%22%3E%0A%20%20%26amp%3Bamp%3Bamp%3Blt%3Bassembly%20name%3D%22MapperAssemblies%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dc62342917314647d%22%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3B%2Fassembly%26amp%3Bamp%3Bamp%3Bgt%3B%0A%20%20%26amp%3Bamp%3Bamp%3Blt%3Busing%20namespace%3D%22MapperAssemblies%22%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3B%2Fusing%26amp%3Bamp%3Bamp%3Bgt%3B%0A%20%20public%20string%20AddTodayToValue(string%20input)%7B%20TransformValues%20helper%20%3D%20new%20TransformValues()%3B%20return%20helper.AddTodayToValue(input)%3B%20%7D%0A%20%20public%20string%20ConcatValues(string%20val1%2C%20string%20val2)%7B%20TransformValues%20helper%20%3D%20new%20TransformValues()%3B%20return%20helper.ConcatValues(val1%2C%20val2)%3B%20%7D%0A%20%3C%2FSCRIPT%3E%0A%20%3COUTPUT%20omit-xml-declaration%3D%22yes%22%20method%3D%22xml%22%20version%3D%221.0%22%3E%3C%2FOUTPUT%3E%0A%20%20%3CTEMPLATE%20match%3D%22%2F%22%3E%0A%20%20%20%20%3CAPPLY-TEMPLATES%20select%3D%22%2Fs0%3AFoo%22%3E%3C%2FAPPLY-TEMPLATES%3E%0A%20%20%3C%2FTEMPLATE%3E%0A%20%20%3CTEMPLATE%20match%3D%22%2Fs0%3AFoo%22%3E%0A%20%20%20%20%3CVARIABLE%20name%3D%22var%3Av3%22%20select%3D%22string(Val1%2Ftext())%22%3E%3C%2FVARIABLE%3E%0A%20%20%20%20%3CVARIABLE%20name%3D%22var%3Av4%22%20select%3D%22string(Val2%2Ftext())%22%3E%3C%2FVARIABLE%3E%0A%20%20%20%20%3CBAR%3E%0A%20%20%20%20%20%20%3CVARIABLE%20name%3D%22var%3Av1%22%20select%3D%22ScriptNS0%3AAddTodayToValue(string(Val1%2Ftext()))%22%3E%3C%2FVARIABLE%3E%0A%20%20%20%20%20%20%3CVAL1%3E%0A%20%20%20%20%20%20%20%20%3CVALUE-OF%20select%3D%22%24var%3Av1%22%3E%3C%2FVALUE-OF%3E%0A%20%20%20%20%20%20%3C%2FVAL1%3E%0A%20%20%20%20%20%20%3CVARIABLE%20name%3D%22var%3Av2%22%20select%3D%22ScriptNS0%3AAddTodayToValue(string(Val2%2Ftext()))%22%3E%3C%2FVARIABLE%3E%0A%20%20%20%20%20%20%3CVAL2%3E%0A%20%20%20%20%20%20%20%20%3CVALUE-OF%20select%3D%22%24var%3Av2%22%3E%3C%2FVALUE-OF%3E%0A%20%20%20%20%20%20%3C%2FVAL2%3E%0A%20%20%20%20%20%20%3CVARIABLE%20name%3D%22var%3Av5%22%20select%3D%22ScriptNS0%3AConcatValues(%24var%3Av3%20%2C%20%24var%3Av4)%22%3E%3C%2FVARIABLE%3E%0A%20%20%20%20%20%20%3CVAL1VAL2%3E%0A%20%20%20%20%20%20%20%20%3CVALUE-OF%20select%3D%22%24var%3Av5%22%3E%3C%2FVALUE-OF%3E%0A%20%20%20%20%20%20%3C%2FVAL1VAL2%3E%0A%20%20%20%20%3C%2FBAR%3E%0A%20%20%3C%2FTEMPLATE%3E%0A%3C%2FSTYLESHEET%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3ERetesting%20the%20Logic%20App%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EAfter%20modifying%20the%20XSLT%2C%20we%20need%20to%20re-upload%20the%20modified%20file%20to%20the%20Integration%20Account.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EOpen%20the%20Integration%20Account%20in%20the%20Azure%20portal%3C%2FLI%3E%0A%3CLI%3ESelect%20%22Maps%22%20under%20Settings%3C%2FLI%3E%0A%3CLI%3EClick%20on%20the%20map%20previously%20uploaded%3C%2FLI%3E%0A%3CLI%3EClick%20the%20%22Update%22%20button%20and%20select%20the%20new%20XSLT%20file%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ERe-run%20the%20test%20in%20Postman.%26nbsp%3B%20The%20Runs%20history%20in%20the%20Logic%20App%20should%20indicate%20a%20successful%20run%2C%20and%20there%20should%20be%20a%20response%20body%20in%20Postman%20with%20the%20values%20which%20are%20generated%20in%20the%20C%23%20assembly.%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%226%22%3ESummary%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIn%20this%20scenario%2C%20we%20looked%20at%20how%20to%20modify%20the%20XSLT%20generated%20by%20the%20BizTalk%20mapper%20to%20correctly%20reference%20an%20external%20assembly%20when%20the%20map%20is%20run%20in%20Logic%20Apps.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1623499%22%20slang%3D%22en-US%22%3E%3CP%3EReuse%20artifacts%20created%20in%20your%20BizTalk%20Server%20solutions%20in%20Azure%20Logic%20Apps!%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft

Overview

Microsoft BizTalk Server is a rich and robust integration platform and is nearing its twentieth birthday(!).  Hundreds, if not thousands, of customers have made significant investments over the years developing their integration solutions on BizTalk Server.  As they move workloads to Azure to either run both in conjunction with BizTalk Server and within Azure natively, they would like to be able to leverage those investments with minimal refactoring.

Azure Logic Apps is an integration cloud service which allows users to schedule, automate, and orchestrate tasks, business processes, and workflows.  Logic Apps functionality both overlaps and complements functionality in BizTalk, but quite helpfully, it also allows for the reuse of existing BizTalk artifacts, such as schemas and maps.

 

BizTalk maps transform messages between different schemas, and use a number of tools within the map to manipulate data during the transformation.  The maps can also utilize external .NET assemblies for these transformations, but because of how BizTalk references these assemblies natively, the maps need some changes in order to be able to reference those assemblies when run in Logic Apps.  This article shows how to edit a map created in BizTalk to utilize external assemblies when run in Logic Apps.  

Scenario
For the purpose of this blog, we will setup a small solution consisting of two schemas, a BizTalk map, as well as an external .NET assembly.  The full solution of BizTalk artifacts and sample files is available here.

 

In this scenario, we have two sample schemas: Foo, representing our source schema, and Bar, representing the target.

JohnScott_0-1598897409311.png  

JohnScott_1-1598897445015.png

We also have a .NET Framework class library, called MapperAssemblies, which contains a small class with two trivial methods:  AddTodayToValue, which will simply append today's day of the week value to the input value, and ConcatValues, which concatenates the input values.

 

 

using System;

namespace MapperAssemblies
{
    public class TransformValues
    {
        public string AddTodayToValue(string input)
        {
            return $"{input} today is {DateTime.Now.DayOfWeek.ToString()}";
        }
        public string ConcatValues(string val1, string val2)
        {
            return string.Concat(val1, val2);
        }
    }
}

 

 

As per most libraries used in BizTalk, this assembly has been signed and added to the global assembly cache (GAC).

 

Finally, we have the map:  This map performs a simple transform of the incoming two values from Foo to the three values in Bar. 

JohnScott_2-1598897691438.png

Each of the three functoids pictured is referencing the sample assembly code, for exmple:

JohnScott_3-1598897764206.png

Testing the map with the following sample input

 

 

<ns0:Foo xmlns:ns0="http://MapWithAssmeblyReference.FooSchema">
  <Val1>Value 1</Val1>
  <Val2>Value 2</Val2>
</ns0:Foo>

 

 

Will yield the following output

 

 

<ns0:Bar xmlns:ns0="http://MapWithAssmeblyReference.BarSchema">
    <Val1>Value 1 today is Monday</Val1>
    <Val2>Value 2 today is Monday</Val2>
    <Val1Val2>Value 1Value 2</Val1Val2>
</ns0:Bar>

 

 

Adding the artifacts to Logic Apps

In order to utilize the BizTalk artifacts in Logic Apps, the artifacts must be stored to an Integration Account in Azure.  Integration Accounts are a companion resource to Logic Apps in Azure, and can be used as a container to store integration artifacts such as maps, schemas and assemblies, as well as certificates and trading partner agreements. 

Create the Integration Account

  • Information on creating an Integration Account is documented here. For the purpose of this sample, the free tier for the Integration Account is adequate. 

Adding Schemas

For both the Foo and Bar schemas, perform the following steps:

  • Open the Integration Account
  • Click on Schemas under Settings
  • Click on + Add
  • Select "Small File" and click the file icon and navigate to the XSD in your BizTalk solution.  The schema name will auto-populate.
  • Click "OK" to add the schema

Adding the map

This step is not quite as intuitive as adding the schemas because BizTalk maps files (btm) are not natively supported by Logic Apps.  However, as BizTalk files compile to XSLT, the output XSLT can be loaded to the Integration Account.

  • Open Visual Studio and open your BizTalk map file.
  • Right-click the BizTalk map file in Solution Explorer, and select "Validate Map"
  • In the Output window for BizTalk output, there will be a link to the output XSLT.  Copy this file location.
  • In the Azure portal, open the Integration Account
  • Click on Maps under Settings
  • Click on + Add
  • Leave the Map Type as XSLT
  • Click the file icon and navigate to the XSLT path from the "Validate Map" step about.  The map name will auto-populate.
  • Click "OK" to add the map

Adding the Assembly

  • In the Azure portal, open the Integration Account
  • Click on Assemblies under Settings
  • Click on + Add
  • Click the file icon and navigate to the DLL for your assembly.  The assembly name will auto-populate.
    • Note:  For DLLs larger than 2 MB, select the "Large File" option.  This will require you to first upload your DLL to Azure Storage and provide the URI to the file. 
  • Click "OK" to add the assembly

Adding the Logic App

While there are many ways to trigger and test the logic app, in this scenario we will create a simple Logic App with an HTTP Trigger and use Postman to test the Logic App.

Create the Logic App

  • In the Azure portal, click "+ Create a resource" and enter Logic App into the search.  Select "Logic App" and follow the wizard to create a new Logic App.
  • Navigate to the newly created Logic App and select Workflow settings under Settings
  • Under "Integration account" select the integration account created in the initial step.  Click Save to save the changes.
  • Click Logic app designer under Development Tools
  • This test will create a simple Logic App with four (4) steps:
    • Set the initial trigger to "HTTP request".  Do not change any settings on this step.
    • Add a XML Validation step to the Logic App after the HTTP request trigger.  The Content will be the value of the Body from the HTTP request.  Add the "Foo schema for the schema name.
    • Add a Transform XML step to the Logic App after the XML Validation step.  The Content will be the value of the Body from the HTTP request and the map will be the Foo-2-Bar map imported to the Integration Account.
    • Add a Response step to the Logic App after the Transform XML step.  The body will be the Transformed XML from the Transform step.
    • Save the Logic App

JohnScott_0-1598910771297.png

 

Testing the Logic App

This scenario will use Postman to test the Logic App, but any equivalent tool can be used.  

  • After saving the Logic App, the HTTP POST URL will be displayed.  Copy this URL to Postman and set the request type to "POST"
  • In the request body, use the sample used previously to test the map

 

 

<ns0:Foo xmlns:ns0="http://MapWithAssmeblyReference.FooSchema">
  <Val1>Value 1</Val1>
  <Val2>Value 2</Val2>
</ns0:Foo>

 

 

  • Click "Send" to submit the POST to Logic Apps.
  • In the Azure portal, click the "Overview" link and view the Runs history.

Looking at the "Runs" history will display an error in the Transform XML step.  The specific error will be similar to the following:
"Code": "Invalid XsltContent",
"Message": "An error occured while processing map. 'Cannot find a script or an extension object associated with namespace 'http://schemas.microsoft.com/BizTalk/2003/ScriptNS0'.'"

JohnScott_1-1598912454341.png


Understanding the error

Looking inside the XSLT generated by the BizTalk map will show us the source of the error.  When BizTalk generates the XSLT, it leaves a namespace reference to the assembly (ScriptNS0), but does not explicitly reference the assembly, which causes Logic Apps to throw the error as it does not know which assembly to associate with this.

 

 

<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0 ScriptNS0" version="1.0" xmlns:ns0="http://MapWithAssmeblyReference.BarSchema" xmlns:s0="http://MapWithAssmeblyReference.FooSchema" xmlns:ScriptNS0="http://schemas.microsoft.com/BizTalk/2003/ScriptNS0">
  <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
  <xsl:template match="/">
    <xsl:apply-templates select="/s0:Foo" />
  </xsl:template>
  <xsl:template match="/s0:Foo">
    <xsl:variable name="var:v3" select="string(Val1/text())" />
    <xsl:variable name="var:v4" select="string(Val2/text())" />
    <ns0:Bar>
      <xsl:variable name="var:v1" select="ScriptNS0:AddTodayToValue(string(Val1/text()))" />
      <Val1>
        <xsl:value-of select="$var:v1" />
      </Val1>
      <xsl:variable name="var:v2" select="ScriptNS0:AddTodayToValue(string(Val2/text()))" />
      <Val2>
        <xsl:value-of select="$var:v2" />
      </Val2>
      <xsl:variable name="var:v5" select="ScriptNS0:ConcatValues($var:v3 , $var:v4)" />
      <Val1Val2>
        <xsl:value-of select="$var:v5" />
      </Val1Val2>
    </ns0:Bar>
  </xsl:template>
</xsl:stylesheet>

 

 

Fixing the error

In order to tell Logic Apps how to associate this reference with the uploaded assembly, we need to tweak the XSLT.  To do this we will need to know the assembly details, the name of the namespace for the helper class, as well as the class name and method signatures of all referenced methods.

As shown in the sample below, we will add an msxsl:script element to the generated XSL which will help Logic Apps associate the script with the assembly.  The key parts to the element are:

  • The implements-prefix attribute indicates which xmlns to associate (e.g. ScriptNS0).
  • The msxsl:assembly element gives the assembly information, including name, version, Culture and PublicKeyToken.
  • msxsl:using namespace attribute indicates which namespace within the assembly is being referenced.
  • One CDATA block for each method being referenced in the mapper. 

For this example, the modified XSLT will look like this (note the msxsl:script element):

 

 

<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0 ScriptNS0" version="1.0" xmlns:ns0="http://MapWithAssmeblyReference.BarSchema" xmlns:s0="http://MapWithAssmeblyReference.FooSchema" xmlns:ScriptNS0="http://schemas.microsoft.com/BizTalk/2003/ScriptNS0">
	<msxsl:script language="C#" implements-prefix="ScriptNS0">
		<msxsl:assembly name="MapperAssemblies, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c62342917314647d" />
		<msxsl:using namespace="MapperAssemblies" />
		<![CDATA[public string AddTodayToValue(string input){ TransformValues helper = new TransformValues(); return helper.AddTodayToValue(input); }]]>
		<![CDATA[public string ConcatValues(string val1, string val2){ TransformValues helper = new TransformValues(); return helper.ConcatValues(val1, val2); }]]>
	</msxsl:script>
	<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
  <xsl:template match="/">
    <xsl:apply-templates select="/s0:Foo" />
  </xsl:template>
  <xsl:template match="/s0:Foo">
    <xsl:variable name="var:v3" select="string(Val1/text())" />
    <xsl:variable name="var:v4" select="string(Val2/text())" />
    <ns0:Bar>
      <xsl:variable name="var:v1" select="ScriptNS0:AddTodayToValue(string(Val1/text()))" />
      <Val1>
        <xsl:value-of select="$var:v1" />
      </Val1>
      <xsl:variable name="var:v2" select="ScriptNS0:AddTodayToValue(string(Val2/text()))" />
      <Val2>
        <xsl:value-of select="$var:v2" />
      </Val2>
      <xsl:variable name="var:v5" select="ScriptNS0:ConcatValues($var:v3 , $var:v4)" />
      <Val1Val2>
        <xsl:value-of select="$var:v5" />
      </Val1Val2>
    </ns0:Bar>
  </xsl:template>
</xsl:stylesheet>

 

 

Retesting the Logic App

After modifying the XSLT, we need to re-upload the modified file to the Integration Account.

  • Open the Integration Account in the Azure portal
  • Select "Maps" under Settings
  • Click on the map previously uploaded
  • Click the "Update" button and select the new XSLT file

Re-run the test in Postman.  The Runs history in the Logic App should indicate a successful run, and there should be a response body in Postman with the values which are generated in the C# assembly.

Summary

In this scenario, we looked at how to modify the XSLT generated by the BizTalk mapper to correctly reference an external assembly when the map is run in Logic Apps.