locked
Receive pipeline component replace "<" , ">" RRS feed

  • Question

  • Folks,

    I get an xml message from sql server and I am debatching it in the Disassemble stage of the pipeline using the pipeline component. I am generating the debatched messages using the System.XML.XMLWriter class. The debatching works just fine but the message that is output contains the "&lt;" and "&gt;" instead of "<" and ">" . This message when applied against the map does not produce expected out. But if I replace the "&lt;" "&gt;" with "<" and ">" save the message to the disk and test the map then the map works just fine.

    Question is how can I get rid of "&lt;" , "&gt;" and replace them with "<" and ">" ? 

    TIA

    Wednesday, October 18, 2017 9:35 PM

All replies

  • Hi,

    You can easy use envelope debatching within pipeline component or use xpath debatching within Orchestration.

    This is the simple way to debatch message rather then doing through custom code . 

    If you are using anything complex mapping within your code  then send a xml document type from  instead of string so that you dont get &lt,&gt issue.


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    Thursday, October 19, 2017 1:21 AM
  • I am generating the debatched messages using the System.XML.XMLWriter class.\

    Hold on a sec...:)

    Why are you doing this?  SQL/Xml/Debatching is all built in.  There is no need, ever really, to use an XmlWriter.

    If you explain a but about this, we can provide the best advice.

    Note, what you are seeing is just escaped Xml which is handled automatically when using the right tools.

    Thursday, October 19, 2017 12:37 PM
    Moderator
  • I have to generate multiple messages depending on unique "TransactionID" values in the "Parent\Child1\Child1" tree. Hence the custom code. I think I may have found a solution still testing though. I can use WriteRaw method belonging to the XMLWriter class to avoid the escape\unescape issue.

    <Parent xmlns="http://baqwas">
        <Child1>
            <Child1>
                <TransactionID>TRN001</TransactionID>
            </Child1>
            <Child1>
                <TransactionID>TRN002</TransactionID>
            </Child1>
        </Child1>
        <Child2>
            <Child2>
                <TransactionID>TRN001</TransactionID>
                <TransDetails>123</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN001</TransactionID>
                <TransDetails>456</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN001</TransactionID>
                <TransDetails>789</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN001</TransactionID>
                <TransDetails>101112</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN002</TransactionID>
                <TransDetails>ABC</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN002</TransactionID>
                <TransDetails>DEF</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN002</TransactionID>
                <TransDetails>GHI</TransDetails>
            </Child2>
        </Child2>
    </Parent>

    and want to generate multiple messages similar to this 

    <Parent xmlns="http://baqwas">
        <Child1>
            <Child1>
                <TransactionID>TRN001</TransactionID>
            </Child1>
        </Child1>
        <Child2>
            <Child2>
                <TransactionID>TRN001</TransactionID>
                <TransDetails>123</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN001</TransactionID>
                <TransDetails>456</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN001</TransactionID>
                <TransDetails>789</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN001</TransactionID>
                <TransDetails>101112</TransDetails>
            </Child2>
        </Child2>
    </Parent>

    <Parent xmlns="http://baqwas">
        <Child1>
            <Child1>
                <TransactionID>TRN002</TransactionID>
            </Child1>
        </Child1>
        <Child2>
            <Child2>
                <TransactionID>TRN002</TransactionID>
                <TransDetails>ABC</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN002</TransactionID>
                <TransDetails>DEF</TransDetails>
            </Child2>
            <Child2>
                <TransactionID>TRN002</TransactionID>
                <TransDetails>GHI</TransDetails>
            </Child2>
        </Child2>

    Thursday, October 19, 2017 4:45 PM
  • HOLD ON!

    Child1, Child2...do not do this!  Using a sequential number.  It will only cause a lot of problems.

    As for you actual situation, I wouldn't use a custom disassembler.  This is a case where I would use a Map to reorganize the message before disassembling.

    If you sample is accurate, you should be able to reorganize based on TransactionID using only Looping and Equal Functoids.

    Then, once you have resorted based on TransactionID, you can debatch the individual messages.

    All of this can be done in an Orchestration.

    Friday, October 20, 2017 1:02 PM
    Moderator
  • Johns-305

    We are trying to build a messaging only solution hence orchestration is not an option. 

    Btw, I have been able to solve this issue when I used the WriteRaw method of the XMLWriter class object. 

    Thanks all for reading through the thread and thanks to Johns-305 for the input.

    Monday, October 23, 2017 2:43 PM
  • For what is worth I agree with what everyone else is trying to tell you.

    This is not the correct approach and will definitely cause problems. You are taking a huge performance hit, and maintainability is highly compromised.

    While we all understand sometimes you have to go with whatever solution you found that works at the time, we are all clearly telling you to not use custom code for this.

    Have a good day :)


    My Technet Articles

    If you like this or another reply, vote it up!
    If you think this or another reply answers the original question, mark it or propose it as an answer.


    Mauricio Feijo
    www.mauriciofeijo.com


    Monday, October 23, 2017 4:44 PM
  • We are trying to build a messaging only solution hence orchestration is not an option.

    For clarity, there are no legitimate reasons to avoid Orchestrations.  In your case, doing so seems to be making your solution unnecessary complicated, meaning it's already a net negative and would make the top of my list for refactoring.

    If someone is telling you this, you can share they're reasons and we'll be happy to help you explain how they are misunderstanding basic BizTalk Dev.

    To be even more clear, Child1...Child2...Child2, do not do this under any circumstances.  It is 100% guaranteed to cause huge problems requiring even more time (meaning money) to fix or work around.

    Monday, October 23, 2017 7:39 PM
    Moderator