IBM i Global

 View Only
  • 1.  IBMi XML Toolkit vs CGIDEV2 ??

    Posted Thu October 07, 2021 07:58 AM

    We are doing an analysis for the best way to do XML processing on IBMi (v7r3m0) via RPG & SQL (preferred)
    For our XML processing  we need to do :

    a). XML outbound: Extract data from Db2 files on IBMi  and build XML for sending to another system via web service
    b). XML inbound: Receive XML from another system  via web service and populate  D2b2 files on IBMi..

     For Best way we are focusing on the "quickest development time" methodology,
    What are pros/cons ..
     But also let me know any other considerations for "best way"

     So far the 2 methods that we are considering are listed below , but please let me know of any others.
    a). IBMi XML Tookkit 7.2 PDF file for XML Toolkit - IBM Documentation
     Let me know if can point me to any good doc /examples on using this method.

    b). CGIDEV2  IBM ILE RPG CGI Tool Set (CGIDEV2) Library (easy400.net)
    including usage of :
     XML-SAX   /   XML-INTO
    Updhtmlvar

    Any and all help is appreciated!
    Thanks 

    John



    ------------------------------
    John Petenes
    ------------------------------


  • 2.  RE: IBMi XML Toolkit vs CGIDEV2 ??

    IBM Champion
    Posted Thu October 07, 2021 09:44 AM
    John, are you certain you need middleware? https://www.ibm.com/docs/en/i/7.4?topic=programming-sql-xml

    ------------------------------
    Jack Woehr
    IBM Champion 2021
    ------------------------------



  • 3.  RE: IBMi XML Toolkit vs CGIDEV2 ??

    Posted Wed October 20, 2021 03:55 PM
    Thank you very much for the reply.   I will review and let you know if I have any other questions

    John M. Petenes

    ------------------------------
    John Petenes
    ------------------------------



  • 4.  RE: IBMi XML Toolkit vs CGIDEV2 ??

    Posted Fri October 08, 2021 09:00 AM
    For consuming XML, I'd suggest using the RPG IV XML-INTO routines. These are native RPG interfaces and provide the most capability. But they do require a bit of trial and error learning when you first get into them. And don't assume the first successful implementation is "the best". I see so many programmers using the first technique they got working and then clone it, along with all the shortcomings, into every new application.

    To generate XML. I used to use our CGILIB with substitution variables, which is substantially similar to CGIDEV2 but runs faster.
    However, since we rolled out SQL iQuery with OUTPUT(*XML) I tend to use it for straight-forward XML output, or use the SQL XML functions.
    The SQL XML Functions are more complex than they need to be for just simple "write every row as XML using the field names as XML tags..."
    But for more complicated stuff, it is the best choice.

    ------------------------------
    Robert Cozzi
    ------------------------------



  • 5.  RE: IBMi XML Toolkit vs CGIDEV2 ??

    Posted Wed October 20, 2021 03:54 PM
    Thank you very much for the reply.   I will review and let you know if I have any other questions

    John M. Petenes

    ------------------------------
    John Petenes
    ------------------------------



  • 6.  RE: IBMi XML Toolkit vs CGIDEV2 ??

    IBM Champion
    Posted Fri October 08, 2021 10:33 AM

    What about a 3rd Option: SQL?

     

    Creating XML Documents with SQL – All Publishing Functions are available since Release 7.1. Complex SQL Statements can be wapped with views in composition with global variables.

    For consuming XML the XML_TABLE Table Function is also available since Release 7.1 (with TR). And again the SELECT statement can be wrapped as an SQL view, which can be used like any table.

    ... in this way the Source Code can be reduced to a minimum (independent which programming language is used) and if something changes only the appropriate view has to be modified.

     

    Mit freundlichen Grüßen / Best regards

     

    Birgitta Hauser

    IBM Champion 2021

     

    "Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown)

    "If you think education is expensive, try ignorance." (Derek Bok)

    "What is worse than training your staff and losing them? Not training them and keeping them!"

    „Train people well enough so they can leave, treat them well enough so they don't want to." (Richard Branson)

     

     






  • 7.  RE: IBMi XML Toolkit vs CGIDEV2 ??

    IBM Champion
    Posted Tue October 12, 2021 07:59 AM
    Hi John; 

    Perhaps you could take a look at noxDb ... it is JSON, XML and Db2 data all-in-one  tool. It aims to solve exactly what you are asking for 

    https://github.com/sitemule/noxDB

    it is open source and comes with loads of examples

    ------------------------------
    Niels Liisberg
    ------------------------------



  • 8.  RE: IBMi XML Toolkit vs CGIDEV2 ??

    Posted Wed October 20, 2021 03:53 PM
    Thank you very much for the reply.   I will review and let you know if I have any other questions

    John M. Petenes

    ------------------------------
    John Petenes
    ------------------------------



  • 9.  RE: IBMi XML Toolkit vs CGIDEV2 ??

    IBM Champion
    Posted Mon October 25, 2021 10:00 AM

    Hi John,

    Generally, I've found that data transformation is best done in a language designed specifically for that, especially if your primary concern is speed of development.

    Specifically, I'd recommend taking a look at Node.js for this use case as you could probably get the functionality you need done in ~3 lines of code (open a db connection, execute your sql, use an open source xml generator to generate the xml). The added benefit of those tools is that they are capable of much, much more than just generating xml, so if you end up also needing to convert data to other formats or run more complex data transformations, those would be pretty easy too.

    In that case, the most complex part of a system like that would be making sure the Node system is secure, performant, and reliable. That's a less easy task, but I'd be happy to help you get that set up.

    Send me an email if you have any questions: aaron@eradani.com

    Good luck with your project!

    Aaron Magid

    Eradani Inc | API Enablement & Open Source Expertise for IBM i

    aaron@eradani.com

    www.eradani.com



    ------------------------------
    Aaron Magid
    ------------------------------