Plex 2E

Expand all | Collapse all

Consume & Publish Webservices from IBMi - Solved

  • 1.  Consume & Publish Webservices from IBMi - Solved

    Posted 06-07-2015 07:47 AM

    Eye catching headline and not exactly true but give this a read and see if you agree.

     

     

     

    Consuming

     

    IBMi REST Webservices made me stop waiting for IBMi variant support from CA but to see how Scott Klement's web page open source projects could help IBMi CA Plex sites.

     

    As noted in the above idea and 2E sites over the years Hypertext Transfer Protocol API project will allow you to write native RPGLE CA Plex functions that can Consume SOAP and RESTful webservices (XML respsonse format)

     

    After installing HTTP API on your IBMi then download the local model called StellaTools1.5_Beta.mdl currently at  Downloads - Stella Tools (CA Plex Developer Tools)

     

    Have a play,

    build StellaTools.Klement.HTTPAPI.Examples.Example16 [SOAP].Example   (Currency Exchange Rate Web service)

    build StellaTools.Klement.HTTPAPI.Examples.Example12 [REST].Example  (Hurricanes with Cities weather forecast)

     

    The way Scott Klement has provided modular reusable service programs allow us as Plex developers to inherit what we need and it really does work. I have both SOAP and RESTful services being called from the IBMi and results been shown back on WinC clients.

     

     

    Publishing

     

    I asked the as400 community (20,000 members) linkedin if there was Performance implications of 'IWS' and 'Do It Yourself Native' REST webservices and heard nothing back. On this forum I had been advised by Crispin to look at PCML before but wanted to wait for CA and maybe avoid the use of Java/C code under the covers.

     

    BUT with 7.2 IBMi supporting RESTFul services now I had a look and consider the matter closed on Publishing. Integrated Web Services (IWS) works great

    • Create PCML files and edit them to give meaningful names. Create a pattern to create them for you as I know Dean_Eshleman already has.
    • Look at scripting the deployment and general maintenance of the publish services like 2E does using the IBM supplied scripts
    • Unfortunately, RPG doesn't currently allow developers to dynamically size arrays or multi-occurrence data structures at run time (this needs verification)  but IWS allows you to use an existing counter output field to restrict the number. Edited: BUT not much use for CA Plex generated functions as you can not specify an Type INT field yet...and you can not output a field only, it is always contained in a data type structure (plex variable) so IWS does not pick the field up as an option from the PCML file. Shame. Will test workarounds

     

     

     

     

    Summary

    Over the years I have waited for CA to support the IBMi and I have had the luxury of using Websydian TransacXML but today when I was forced to investigate I believe a CA Plex site can publish and consume webservices natively on the IBMi for no additional cost.



  • 2.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-07-2015 08:02 AM

    For PUBLISHING if Time permits I would like to

    encapsulate programmatic invocation of IBM's Web Service Administration scripts in to StellaTools.

    IBM ships the following scripts .

     

    Script

     

    Purpose

    installWebService.shCreate and deploy a Web Service
    listWebServices.shList Web Services deployed to a Web Services Server
    startWebService.shStart a deployed Web Service
    stopWebService.shStop a deployed Web Service
    uninstallWebService.shUninstall a deployed Web Service
    createWebServicesServer.shCreate Web Services Server*
    deleteWebServicesServer.shDelete Web Services Server*
    startWebServicesServer.shStart Web Services Server*
    stopWebServicesServer.shStop Web Services Server*


  • 3.  Re: Consume & Publish Webservices from IBMi - Solved



  • 4.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-09-2015 10:51 AM

    Well done George!  I'm digging into the model now.

     

    Ran through Examples 1,12, 16 .  All work great.  Let us know if get those publishing work around issues resolved!

     

    Cheers,



  • 5.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-09-2015 04:56 PM

    Thanks Rob for having a test. I was staggered how easy it all became and how Klements RPGLE coding lent it self to Plex...maybe Scott Klement is a secret Plex developer..now that would be a coup.



  • 6.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-13-2015 07:55 PM

    I have used both Scott Klement's   open source and RXS-XML on our system. But we have a problem with other open source package and had no support. so we don't run open source code.

    I will say I trust Scott's code fully. just a rule we have now.



  • 7.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-14-2015 01:20 AM

    Thanks John for your input and sorry another open source project spoiled it for your management. Why they cant judge things on a case by case basis..like life...is puzzling..things are not black and white

     

    For others who are have not considered Klement's open source my rational is:

     

    1. If IBM Champion Jon Paris sayshttp://www.ibmsystemsmag.com/ibmi/developer/rpg/web_service_rest/Scott Klement’s HTTPAPI is an excellent tool to let RPG programs consume both REST and SOAP Web services. Then who am I to argue.

    2. You have all the source no black boxes, could be argued CA Plex with its runtimes and no source poses a greater risk

    3. Klement's user base may well be bigger than CA Plex user base

    4. Klement's HTTPAPI project has active forum

    5 .IBM uses open source IBM Systems Magazine - XMLSERVICE Offers New Life for RPG Programs.

    6. Klements is the highest quality code I personally have ever seen, multiple times better than what I have worked with over the years.

    7. A way to introduce new techniques and best practice to IBMi shop and to learn yourself

    8. Mature (2003) and stable but uses more up to date techniques than CA Plex generated source

    9. Constantly being improved and functionality added to as opposed to CA Plex patterns

    10. Free

     

    Predictably a by product of using and getting to know the source (always advisable with open source) was I learnt further how CA Plex generated source with its goto tags is light years behind modern free format RPG. And the limitations of CA Plex were highlighted for example by not supporting subprocedures in the action diagram.



  • 8.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-14-2015 10:09 AM

    If there is one person in this industry I trust & respect it is Scott Klement. I still use HTTPAPI on our system today.

    http://www.scottklement.com/presentations/Web%20Services%20for%20RPGers.pdf I read this all the time.



  • 9.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-14-2015 12:37 PM

    that doc is in my favourites above, wish I could write the way he can. Have a good evening.



  • 10.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-15-2015 10:34 AM

    I been think about using YAJL for our JSON need. What are comment with JSON on the ISeries ? I think this is the only option I have for consume and publishing ?



  • 11.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-15-2015 10:58 AM

    Not your only option as IWS now supports publishing your pgm is a restful service with json as the output format.

     

    I too was looking at yet another json library to do consumption but happy to parse xml for the time being but think json is more relevant in terms of publishing



  • 12.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-15-2015 12:06 PM

    my Json is to complex to map program parameters, I was so happy to read that it supported it, but IWS only handle simple stuff. The in-house JSON I am ok, its when you have to deal with external systems. Account work orders are just to complex for IWS.



  • 13.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-15-2015 11:13 AM

    http://powerext.com/JSON_RPGLE.pdf

     

    Or convert json into xml then parse. I liked this practical approach for consummation. Have been meaning to look at PowerExt as the author is based close to me and Iike the Danes!



  • 14.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-28-2015 11:52 AM

    Hi John,

     

    TechTip: Check Out the New DB2 for i HTTP Functions

     

    What can not you do in SQL these days, based on java so there is the JVM overhead issue so glad the article specifically mentions the use Scott Klement's HTTP API library if speed is required

     

    ..............................................................

     

    Have looked at powerExt now and like the look of jsonToXML() which would enable the current version of this solution to consume JSON responses as well abeit on the "el cheapo" as Michael Sansoterra puts it in TechTip: JSON and XML Conversion in DB2 for i | Programming

     

    ..............................................................

    Lastly will be exposing another of Scott Klements open source projects YAJL as reading around this subject it has universally recognised as the fastest parser of json which should help people if "el cheapo" method above does not suit and you want to parse json yourself.

     

    In the end really close to my blue sky thoughts at the start of this journey IBMi REST Webservices



  • 15.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 06-28-2015 12:01 PM

    Lastly did have an objection to using Scott Klements HTTPAPI on the production library as it was open source etc...think the person simply had a bad day...but was adamant at the time. I quickly did a wrkobj and showed him the objects were already in production as not one but two of the IBMi products that have been purchased to accomplish certain tasks already use Scott Klements HTTP Lib.... So argument was over and gave me confidence in the solution as this open source project is used in more places than Plex itself *not a fact but 2000 shops using HTTPAPI is quoted by klement which is more than double the number of Plex sites I have ever heard quoted.



  • 16.  Re: Consume & Publish Webservices from IBMi - Solved

    Posted 07-01-2015 03:13 AM

    Update Consuming:

    Can now Consume SOAP and RESTful webservices (XML respsonse format & JSON respsonse format)

     

    A joint production HTTPAPI-Klement / PowerExt-Rutzou / StellaTools-Jeffcock