XML. to flat file

Home Page Forums BizTalk 2004 – BizTalk 2010 XML. to flat file

Viewing 1 reply thread
  • Author
    Posts
    • #16922

      Hello All,

      I have a message of type System.XML.XMLDocument and I would like to convert it to a flat file before i send it to another location. I am not able to do this because I am unable  to use the flat file assembler and that requires me to specify  a schema before hand. I dont have a schema for that but I would basically like my XML document to be converted into a flat file when I recive it from Biztalk.

       

      Thanks,

      Jess 

    • #16924

      There are three ways of converting an Xml document to a flat file.

      1. Flat file Assembler – this requires a flat file schema that describes the flat file format. You do not have to set the schema on the Assembler component in the pipeline. You can dynamically set the BTS.MessageType on each message, which is a reference to the schema.

      2. Custom Xslt in a map. You will need to write your xslt and then implement a dynamic mapping orchestration:
      http://www.biztalkgurus.com/Samples/Dynamic-Transforms-BizTalk-2006.html

      3. Write a .Net component that will create the flat file for you and call this from the orchestration.  

       

      • #16929

        Hi Greg, Thanks for your help can u please suggest me how to use a .Net component….

         

        Thanks,

        Jess

        • #16930

          You will need to write a .Net component that you can call from an orchestration, passing an XlangMessage and returning an XlangMessage.
          In your .Net code you would read the data stream from the message and transform into a flat file stream

          I have thought of another method of doing this, a custom assembler that would sit in the send pipeline. You would use similar code as above to convert the message data stream from xml to flat file. If you are dealing with large messages this may be more efficient.

          What is the reason why you cannot use a flat file schema and  why you are using an untyped xml message?
          if you could explain a bit more about the process there may be other options available 

          • #16931

            Greg, I am receiving a flat file message and I call another orchestration to pre process my data. The problem is I am receving atleast 50 varites of data in my main orchestration and I Have this pre processor as a common component among all the 50. Therefore as sooin as u recv one msg I convert it to System.xml and i pass to my call orchestration . This saves me a lt of time regarding the maintenece of the preprocessor as everyone can convert their data into an system.xml and send it to this pre processor which can process the data, but after it is processed i want to send the original data and the preprocessed data to another location. I would like to send my original dta in the native format it was recvd (ie., flat file)

             PS can you please show me examples of how to do this

            Thanks,

            Jess

            • #16950

              If you are sending the exact same message out thru the send port then you may be able to use a flat file assembler in the send pipeline. Do not specify the schema on the Flat File assembler and it will check the BTS.MessageType in the message context and use that schema to convert to a flat file. Even though you have declared the message as type XmlDocument in you orchestration it will still have the message context properties created in the receive pipeline.

              If you copy the message in the orchestration you will lose the context properties, so you will also need to explicitly copy these as well
              e.g.
              outputMessage = inputMessage
              outputMessage(*) = inputMessage(*)

               

              • #16959

                Hi Greg, Thanks for that explanation. I shall copy the above in my expression shape, But i am not sure how to use a Flat file assembler without specifying the properties for document schema in my flat file assembler.

                 

                Thanks,

                Jess

                • #16961

                  If the document schema property on the Flat File Assembler is blank, the assembler will try to use the schema that matches the message type of the message.

                  I have built a small project that contains a Flat File receive pipeline (FF Disassembler + Party Validation) and a Flat File send pipeline (Flat File Assembler). This project is deployed into a Biztalk application, I call Common. I can then reference this application from my other Biztalk applications.  When I need to send or receive a flat file I use one of these pipelines. I use the per instance pipeline configuration feature of BTS2006 to specify the document schema on the receive pipeline, and almost never specify the document schema on the send pipeline. 

                  • #16963

                    Thank you, I shall try that, I shall create a send pipeline with a flat file assembler. Under the document schema specifications I shall select the per instance config and in my expression shape I shall create the new message as stated above before sending it.

                    I guess I need to use a flat file dis assembler when I receive the message initially otherwise I dont think this would not work with a pass thru pipeline.

                     

                    Thanks,

                    Jess 

                     

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