none
Assign a variable to System.Xml.XmlDocument message

    Question

  • I am trying to load a flat file from a expression shape to an orchestration variable (this variable is string type which contains flat file data), and I want assign that variable to a System.Xml.XmlDocument type message.
    Loading a flat file to a string variable is possible but I am unable to assign the variable to a System.Xml.XmlDocument type message. Please help.

    Thanks !!
    Friday, October 16, 2009 9:48 AM

Answers

  • First use FlatFile Disassembler pipeline component to convert the flat file into XML. Once it is converted into XML, You can assign it to any orchestration variable of type System.Xml.XmlDocument.

    Regards,
    Abhijit
    Abhijit Mahato Please "Mark as Answer" if Post has Answered the Question
    Friday, October 16, 2009 10:03 AM
  • The problem is, flat file data will not be valid XML data so you can't assign that value to System.Xml.XmlDocument. As Abhijit mentioned you would have to change the flat file into XML using xml disassembler.

    Ajeet Kumar
    Friday, October 16, 2009 10:37 AM
  • This can be done only if the the flat file data is in XML format. Following steps will be helpful to assign flat file data to System.XML.XmlDocument variable:

    • Create a message msgXML with message type System.XML.XmlDocument
    • Create variable varXML of type System.XML.XmlDocument
    • Assign varXML with flat file data
    • Add message assignment in the Orchestration and add code like msgXml = varXML; Use XPath to assign varXML data to the corresponding message
    • XML message should be properly formated.

    Try with the above steps

    Friday, October 16, 2009 7:24 PM

All replies

  • First use FlatFile Disassembler pipeline component to convert the flat file into XML. Once it is converted into XML, You can assign it to any orchestration variable of type System.Xml.XmlDocument.

    Regards,
    Abhijit
    Abhijit Mahato Please "Mark as Answer" if Post has Answered the Question
    Friday, October 16, 2009 10:03 AM
  • The problem is, flat file data will not be valid XML data so you can't assign that value to System.Xml.XmlDocument. As Abhijit mentioned you would have to change the flat file into XML using xml disassembler.

    Ajeet Kumar
    Friday, October 16, 2009 10:37 AM
  • If its a raw data from the flat file it cannot be assigned to the XMLDocumentVariable. However you can assign all the data within one root node but I dont think it would be of some use to you.

    myXmlDocumentVar.LoadXml("<Root>" + mystring + "</Root>");

    If you want it to be in XML you have to create an XML schema and then make a custom pipeline with the disassembler component to conver the Flat file to XML. You can also call pipleline within orchestration, you can follow this post for this. http://abdulrafaysbiztalk.wordpress.com/2008/08/10/calling-send-and-receive-pipelines-from-the-orchestration-expression-shapes/


    Abdul Rafay http://abdulrafaysbiztalk.wordpress.com/ Please mark this as answer if it helps
    Friday, October 16, 2009 11:11 AM
  • This can be done only if the the flat file data is in XML format. Following steps will be helpful to assign flat file data to System.XML.XmlDocument variable:

    • Create a message msgXML with message type System.XML.XmlDocument
    • Create variable varXML of type System.XML.XmlDocument
    • Assign varXML with flat file data
    • Add message assignment in the Orchestration and add code like msgXml = varXML; Use XPath to assign varXML data to the corresponding message
    • XML message should be properly formated.

    Try with the above steps

    Friday, October 16, 2009 7:24 PM
  • If you are trying to load a FF message from a receive location to a msg configured as System.Xml.XmlDocument in orchestration, then it is possible. Have a receive port with pass thru receive pipeline and bind it to orchestration receive shape. You will receive the FF message in orchestration message variable without any issue.
    Genuine Basil
    Friday, October 16, 2009 7:38 PM
  • From expression shape, please try using the RawString class (http://msdn.microsoft.com/en-us/library/ee253435(BTS.10).aspx) instead of the normal string..not sure if it works.. but give it a try..


    Genuine Basil
    Friday, October 16, 2009 7:47 PM