locked
Mapping multiple source schema (where some can be optional) to single destination from Orchestration RRS feed

  • Question

  • I have a problem where in i have to map multiple source schema to a single destination document. I know it can be done using transformation  shape and choosing multiple messages representing different source schemas from orchesteration.

    But problem is that some of my source schema messages are optional and in that case I get "Root element not found" exception while  applying map.

    To give a little background i am trying to map one header file (which i will always get) and multiple detail files (which are optional -- may or may not come) to a single schema of an ERP system.

    Can someone give me  a general idea how this can be achieved?

    What i tried : 1. try mapping header schema to destination 2. then if details present try mapping details schema to destination but this results in overwriting of the destination schema...by the latest map applied, in this case details to destination will override the contents of the destination derived from the first map.

    2.Making the elements root node of the details , in the combined map as optional -- still i get the "root element not found " exception when details are not present.

    Tuesday, May 16, 2017 7:00 AM

Answers

  • You'll have to stub out your optional messages.

    You can usually do this by a cheeky XmlDocument variable and then just the root element defined in an Expression Shape.

    e.g.

    xmlDocument.LoadXml("<mymessage xmlns=\"urn:something\">whatever</mymessage>");


    If this is helpful or answers your question - please mark accordingly.
    Because I get points for it which gives my life purpose (also, it helps other people find answers quickly)

    • Marked as answer by a.k.4.7 Tuesday, June 6, 2017 12:17 PM
    Thursday, June 1, 2017 3:50 PM

All replies

  • You'll have to stub out your optional messages.

    You can usually do this by a cheeky XmlDocument variable and then just the root element defined in an Expression Shape.

    e.g.

    xmlDocument.LoadXml("<mymessage xmlns=\"urn:something\">whatever</mymessage>");


    If this is helpful or answers your question - please mark accordingly.
    Because I get points for it which gives my life purpose (also, it helps other people find answers quickly)

    • Marked as answer by a.k.4.7 Tuesday, June 6, 2017 12:17 PM
    Thursday, June 1, 2017 3:50 PM
  • HI ak47,

    You need to have the dummy messages setup if the input messages do not come in , you can use the xmldocument to load the dummy message structure and pass it to the transform shape. You can have a logic in orch to check if the message has come in or not, if the message is there you just invoke the transform if not load up the dummy message and then invoke the map. You can do something like below.

    xmlDoc=new System.Xml.XmlDocument();
    xmlDoc.LoadXml("Dummy Message generated using the generate instance for the scheama pertaining to the message");
    //If msgOptional is the Ofitional Message
    msgOptional=xmlDoc;
    You will need to do above steps in a construct message shape


    Mandar Dharmadhikari

    Friday, June 2, 2017 12:28 AM
    Moderator
  • I did the same and it worked. Thank you Mandar and Alastair
    Tuesday, June 6, 2017 12:17 PM