IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  Add a new XML segment at runtime ?

    Posted 03/15/16 06:14 AM

    Hello.

    i have an incoming XML message. At runtime and depending on some conditions i must add some segments and several hierarchy levels.

    What will be the best approach for doing so ?

    I just thought about a LOOP step, an external .NET service with a LINQ logic, a java service,…

    But i dont find a ESB service for adding a new xml segment or node to a existing xml document.

    Thanks for your ideas :slight_smile:

    BR,
    Sebastian


    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: Add a new XML segment at runtime ?

    Posted 03/15/16 06:58 AM

    Hi,

    you can try the following approach.

    1. create the document type using xml schema
    2. convert the xml string to document and map to the document type generated in step 1
    3. map the new data to the document
    4. convert the document to xml string.

    or
    you can make use of xslt files. we have built-in services which takes the document and xslt file as input and returns the xml file.


    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: Add a new XML segment at runtime ?

    Posted 03/15/16 07:51 AM

    As xml is just a string variable in webMethods, you can use string based operations like concat, append etc to manipulate the XML content at run time.


    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Add a new XML segment at runtime ?

    Posted 03/15/16 12:54 PM

    Hi,

    modifying the xml string directly can teadious depending on the complexity of the message.
    On the other side the mentioned string operations are very cost-intensive regarding their runtime.

    I prefer one of the approaches Naga has suggested.

    Regards,
    Holger


    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: Add a new XML segment at runtime ?

    Posted 03/15/16 01:03 PM

    Hello.

    thanks for your replies.

    will it be possible to use e.g. service “pub.xml:xmlNodeToDocument” and still preserve all document type elements
    although they are not present in the source xml ? Normally they are elimnated from pipeline if empty.

    I ask why i need the (even) empty values (here CONTROLLER) for calling webservice later on.

    Can this be done by XSLT ? Is there any sample for doing so ?

    Please find screenshot attached. :slight_smile:

    BR,
    Sebastian


    #webMethods
    #Integration-Server-and-ESB


  • 6.  RE: Add a new XML segment at runtime ?

    Posted 03/15/16 01:24 PM

    Hi Sebastian,

    looks like a defect in your Designer.

    Can you provide us the version of Designer and the applied ESB-Fix (for the ServiceDevelopment Part)?

    The referenced DocTypes (DocType names) are not part of the xml message itself but of the flow service implementation. So they should not get lost.
    More likely this is just a displaying issue.

    Regards,
    Holger


    #Integration-Server-and-ESB
    #webMethods


  • 7.  RE: Add a new XML segment at runtime ?

    Posted 03/15/16 02:44 PM

    I guess, there is no feature to generate these null tags using xmlNodeToDocument service.
    However, this can be done, using the documentToXMLString service by setting generateRequiredTags to true.

    And I guess, this will generate only the null fields if they are mandatory. But it won’t generate if they are optional.
    and for optional fields, i believe, there won’t be any issue in Webservice invocations with this approach, as they are anyway optional fields.

    so, convert the run time xmlString (won’t consists of all nodes) ->xmlNode->xmlDocument (consists of all nodes at design time, won’t present at run time ) ->xmlString (with above option, generates missing tags)


    #Integration-Server-and-ESB
    #webMethods


  • 8.  RE: Add a new XML segment at runtime ?

    Posted 03/20/16 01:25 PM

    Even in java using parsers we can do so, please give a try.

    Thanks,


    #Integration-Server-and-ESB
    #webMethods