Pulling specific files through a receive port?

Home Page Forums BizTalk 2004 – BizTalk 2010 Pulling specific files through a receive port?

Viewing 1 reply thread
  • Author
    Posts
    • #12399

      I am new to BT2004 and am using it to transform and associated data from multiple sources into a single message to an execution system.
      I will receive orders to make stuff from the business system, and from data within the order body I will determine which recipe source file to associate to the order. I will get the orders via file drop, but the recipe data files will all be in a single directory with unique names, and I will know which one to read based upon fields in the order message. So my initial thought was to receive the order, parse out the recipe file details, and then read THAT file and merge the data. I can’t find a way to dynamically assign a specific file in a specific location to a receive location – Can this be done? Do I have to write custom .NET?

      Thanks,
      Wade

    • #12400

      I have found an interesting solution to pulling specific files into an orchestration –
      In my situation,
      1) I receive a production order transmission that includes data that is used to derive a specific recipe file reference that contains information that I need to complete my transmission to the execution system.
      2) In the orchestration, I pass the received production order to a map that has an external XSLT file (example bellow)
      3) This map copies the received message along with a copy of the required file into the same intermediate output file – the schema for this file includes the schema from the first message with the additional structure of the included file(s)
      4) The output of the map is the combined files which can be further processed as necessary.

      My example XSLT that combines the input message with a copy of a referenced file (3 times in this example)
      I believe this approach can be extended to accommodate a wide variety of file combinations –
      Note this does not use a receive port/pipeline to retrieve the added files, but the file can be the results of other orchestrations that preprocess the data if necessary.
      If the file specified by the ‘document()’ reference does not exist, nothing is copied –
      So it might be wise to check the output file for the existence of nodes from the referenced file for error management, etc.

      Example \”CombineFiles.xslt\”

      <?xml version=\”1.0\”?>
      <xsl:stylesheet version=\”1.0\” xmlns:xsl=\”http://www.w3.org/1999/XSL/Transform\” xmlns:xs=\”http://www.w3.org/2001/XMLSchema\” xmlns:fn=\”http://www.w3.org/2005/02/xpath-functions\” xmlns:xdt=\”http://www.w3.org/2005/02/xpath-datatypes\” xmlns:ns0=\”http://WTest2.SAPPhase2PlusTcMFile\”>
      <xsl:output method=\”xml\” version=\”1.0\” encoding=\”UTF-8\” indent=\”yes\”/>
      <xsl:template match=\”/\”>
      <ns0:AllFiles>

      <!– this first copy duplicates the first source file in the combined output file –>
      <xsl:copy-of select=\”*\”/>

      <!– here is a direct file included in the output –>
      <xsl:copy-of select=\”document(‘C:\\00006856-3.xml’)\”/>

      <!– or here, an element in the first – source file contains the file
      reference to the second file to be included in the output –>
      <xsl:copy-of select=\”document(//RecipeFileRef)\”/>

      <!– OR here by using a variable that is derived from elements in the
      first source file that derives the name of the file to be inlcuded, etc. –>
      <xsl:variable name=\”RcpFile\” select=\”//RecipeFileRef\”/>
      <xsl:copy-of select=\”document($RcpFile)\”/>

      </ns0:AllFiles>
      </xsl:template>
      </xsl:stylesheet>

      Good Luck!
      Wade

      • #12401

        I don’t think this can easily be done using the existing adapters.

        The only think I can think of is to have the first message start an Orchestration. Then, either use some type of Convoy to collect the other messages or just use System.IO to read the messages by-passing the file adapter.

        Using a Convoy gets difficult if you do not get the message that lists the other file first before any of the other messages.

        Best of luck.

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.