Parameterize Itinerary XML exports

Topics: ESB Toolkit Integration
Nov 5, 2014 at 9:36 AM
Hi,

is it possible to parameterize the Itinerary xml file without using the SSO Resolver?

Given we use the Static Resolver for the "Tranport" and "Location" Property. We dont want to manually edit the "Location"-Property in the xml file for every different stage.

So is it possible to define the Location in the Excel Sheet and use the variables in the xml export file? In this szenario the btdf would replace the values on deployment time based on the Excel sheet and the runtime use a static resolver.

thanks for feedback
christian
Coordinator
Nov 7, 2014 at 6:06 AM
Edited Nov 7, 2014 at 6:07 AM
Hi Christian,

Yes, use FilesToXmlPreprocess. When the MSI packages the itinerary XML files, they go into a folder named ESB. Unless you also use a folder named ESB in your BizTalk solution, you'll have to account for that difference between a "Server" and non-"Server" deployment. I didn't test it, but something along these lines:
<ItemGroup Condition="'$(Configuration)' != 'Server'">
  <FilesToXmlPreprocess Include="Itinerary1Master.xml">
    <LocationPath>..\Itineraries</LocationPath>
    <OutputFilename>Itinerary1.xml</OutputFilename>
  </FilesToXmlPreprocess>
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Server'">
  <FilesToXmlPreprocess Include="Itinerary1Master.xml">
    <LocationPath>..\ESB</LocationPath>
    <OutputFilename>Itinerary1.xml</OutputFilename>
  </FilesToXmlPreprocess>
</ItemGroup>
If you prefer, you can use a conditional PropertyGroup for LocationPath instead of duplicating the entire item as I did here.

Thanks,
Tom
Nov 12, 2014 at 3:00 PM
Hi Tom,

Is there a way we can parameterize the values inside an Itinerary instead of entire Itinerary file? Or generate complete Itinerary based on the chosen deployment server?

As the end point on the ItineraryServices vary between platforms if there is a way to generate the Itinerary XML file based on the declared parameter values from the setting file, it would ease the deployment as well.

Thank you
Koushik
Coordinator
Nov 13, 2014 at 5:27 AM
Hi Koushik,

The XML preprocessing replaces specific tokens or areas within the XML, not the entire file, so I'm not sure I'm understanding your question. If you have an itinerary XML that needs to be modified for different environments, you can use the method described here or use the BTDF SSO resolver.

Thanks,
Tom
Nov 13, 2014 at 7:59 AM
Hi Tom,

your solution works fine for non-server deployment. On a server deplyoment i have the following problem:

<ItemGroup Condition="'$(Configuration)' != 'Server'">
<FilesToXmlPreprocess Include="MyEvent.xml">      
  <LocationPath>..\$(BizTalkProjectItineries)</LocationPath>
  <OutputFilename>MyEvent.generated.xml</OutputFilename>
</FilesToXmlPreprocess>
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Server'">
<FilesToXmlPreprocess Include="ESB\MyEvent.xml">
  <LocationPath>..\ESB</LocationPath>
  <OutputFilename>MyEvent.generated.xml</OutputFilename>
</FilesToXmlPreprocess>
</ItemGroup>

<ItemGroup>
  <EsbItineraries Include="MyEvent.generated.xml">
    <LocationPath>..\$(BizTalkProjectItineries)</LocationPath>
  </EsbItineraries>
</ItemGroup>

when i create the MSI Package, the file MyEvent.generated.xml cannot be found. If i replace it with MyEvent.xml the EsbImportUtil.exe tool doesnt install the replaced Itinerary file.

Thanks
christian
Nov 13, 2014 at 2:21 PM
Edited Nov 13, 2014 at 2:24 PM
Thank you for super quick reply Tom. :).

Absolutely, the token replacement is working on our for non ESB projects.

After creating the MSI and running it on the other server, I expected an option other than port bindings which can generate the Itinerary for that environment. I am using a custom resolver (Sentinet), and with BTDF trying to retrieve the keyword values from the Settings and then create Itinerary followed by deploying. Am I missing anything here. When I deploy on my local development the file is created and deployed correctly.
   <PropertyGroup>
    <RequireXmlPreprocessDirectives>False</RequireXmlPreprocessDirectives>
    <EnableXmlPreprocess>True</EnableXmlPreprocess>
  </PropertyGroup>

  <ItemGroup> 
    <FilesToXmlPreprocess Include="TestItineraryWithBtdf.xml" >
      <LocationPath>..\Test.Itineraries</LocationPath>
      <OutputFilename>TestItineraryWithBtdf.Gen.xml</OutputFilename>
    </FilesToXmlPreprocess>
  </ItemGroup>

  <ItemGroup>
    <EsbItineraries Include="TestItineraryWithBtdf.Gen.xml">
      <LocationPath>..\Test.Itineraries</LocationPath>
    </EsbItineraries>
  </ItemGroup>
Thank you
Koushik
Coordinator
Nov 13, 2014 at 2:52 PM
Christian,

It looks like you repeated the ESB folder in both the filename and the LocationPath. The filename should just be MyEvent.xml.
<ItemGroup Condition="'$(Configuration)' == 'Server'">
  <FilesToXmlPreprocess Include="MyEvent.xml">
    <LocationPath>..\ESB</LocationPath>
    <OutputFilename>MyEvent.generated.xml</OutputFilename>
  </FilesToXmlPreprocess>
</ItemGroup> 

You'll probably need to move EsbItineraries into conditional ItemGroups too because of the varying path. The other option is to make the value of LocationPath a property of your own name, and put that property into a conditional PropertyGroup. Then you would have only one FilesToXmlPreprocess and one EsbItineraries.

Thanks,
Tom
Coordinator
Nov 13, 2014 at 2:59 PM
Koushik,

Since you say it is working in Visual Studio and not in the MSI, I suspect you have a similar issue to Christian. The location of the itinerary XML files moves in a Server deploy to ..\ESB, so you must account for that with a conditional PropertyGroup that checks if '$(Configuration)' == 'Server'.

Here's a complete example:
<PropertyGroup Condition="'$(Configuration)' != 'Server'">
  <EsbItinerariesLocationPath>..\Itineraries</EsbItinerariesLocationPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Server'">
  <EsbItinerariesLocationPath>..\ESB</EsbItinerariesLocationPath>
</PropertyGroup>

<ItemGroup> 
  <FilesToXmlPreprocess Include="TestItineraryWithBtdf.xml" >
    <LocationPath>$(EsbItinerariesLocationPath)</LocationPath>
    <OutputFilename>TestItineraryWithBtdf.Gen.xml</OutputFilename>
  </FilesToXmlPreprocess>
</ItemGroup>

<ItemGroup>
  <EsbItineraries Include="TestItineraryWithBtdf.Gen.xml">
    <LocationPath>$(EsbItinerariesLocationPath)</LocationPath>
  </EsbItineraries>
</ItemGroup>
Thanks,
Tom
Nov 17, 2014 at 2:53 PM
Thanks again Tom,

I made this work now.

After multiple retries here is the code snippet:
  <!-- If Reletive path is not specified in the Include and included in the LocationPath, during the MSI installation
       XMLPreprocessor returns Inputfile not found error See image:1
  -->
  <ItemGroup>
    <FilesToXmlPreprocess Include="ESB\TestItineraryWithBtdf.xml">
      <LocationPath>..</LocationPath>
      <OutputFilename>TestItineraryWithBtdf_$(Configuration).xml</OutputFilename>
    </FilesToXmlPreprocess>
  </ItemGroup>

  <!--
    If not added BTDF will retun error: 
        Could not copy the file "..\TestBizTalkComponents.ESB\TestBizTalkComponents.itinerary" because it was not found.
  -->
  <ItemGroup Condition="'$(Configuration)' != 'Server'">
    <EsbItineraries Include="TestItineraryWithBtdf.xml">
      <LocationPath>..\Test.Itineraries</LocationPath>
    </EsbItineraries>
  </ItemGroup>

  <ItemGroup Condition="'$(Configuration)' == 'Server'">
    <EsbItineraries Include="TestItineraryWithBtdf_$(Configuration).xml">
      <LocationPath>..\ESB</LocationPath>
    </EsbItineraries>
  </ItemGroup>
Some notes on my investigation:
  1. When VS tires to build the MSI with BTDF plugin when EsbItineraries for non server is not added, it complains about missing XML file (Itinerary).
  2. When the missing ItemGroup is added with a token based parameter, although it can build the MSI it will failed during installation on the server with error Inputfile cannot be found /ESB/ItineraryName.xml
  3. If the XMLPreprocess files for the Server do not have 'ESB\' in the include but in location path it will again fail with the error Input file not found.
I was able to install, deploy and check on multiple servers with various settings and after multiple retries finally the parameters are replaced in the deployed Itinerary.

Thank you

Cheers
Koushik