EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
  • 1.  REST API from IBM i

    Posted Wed April 20, 2016 04:13 AM

    Dear collective wisdom,

    we have written our batch programs running on IBM i using EGL. In the future we will need to integrate with external Web service. Is there a reasonable way to call a REST service from a COBOL program generated from EGL running on IBM i. Alternatively, if that won't work we might try SOAP service as a secondary option.

     

    All the best,

    Tuukka

    TuukkaIlomäki


  • 2.  Re: REST API from IBM i

    Posted Wed April 20, 2016 10:26 AM

    Tuukka,

     

    I am not aware of any ability to call out to a REST service directly from EGL.  Of course, if native RPG, COBOL, or CL can do this, then you could call that.

     

    We do support invoking a SOAP service from generated EGL COBOL Batch programs.   The best doc I could find is this info using this link:

     

    http://www.ibm.com/support/knowledgecenter/SSMQ79_9.5.0/com.ibm.egl.pg.doc/topics/pegl_serv_types_cpt.html?lang=en

     

    EGL-generated Java and COBOL code are both in use when an EGL-generated COBOL program is deployed on IBM i and accesses a SOAP service. To understand the implication, be aware of the following runtime events:

    1. The EGL-generated code calls the local, EGL-generated proxy.

    2. The proxy calls the EGL COBOL runtime code; specifically, the catcher program that handles the data conversion between COBOL and Java.

    3. The catcher program uses the Java Native Interface (JNI) to invoke EGL Java runtime code, which runs on the Java Virtual Machine (JVM) on IBM i.

    4. The EGL Java runtime code accesses the SOAP service locally or remotely.

    The initial call to the proxy is slow because the EGL Java runtime code is loaded, including all the JAR files in the classpath. The loading occurs only on the first call or after IBM i unloads the JVM from memory.

    Attached is a picture of this.

    I am trying to find any more detailed doc.

     

    markevans


  • 3.  Re: REST API from IBM i

    Posted Thu April 21, 2016 02:12 AM

    Hello Mark,

    I think this sounds a plausible alternative. The third party vendor we are integrating with is using an ESB and one of the selling arguments of ESBs is that you can easily provide data in different formats. I am sure we can persuade them to provide us with a SOAP interface.

    Does this require RBD 9.5? I did not find corresponding documentation in RBD 9.1. We will need to keep running RBD 9.1 for JSF development, but I am sure the two will co-exist peacefully. And in any case, it will be different developers doing the batch programs than the web programs.

     

    Tuukka

    TuukkaIlomäki


  • 4.  Re: REST API from IBM i

    Posted Thu April 21, 2016 08:37 AM

    Tuukka,

     

    Sounds good.

     

    The SOAP interface I referred to was introduced back in RBD V7, so it is also available in RBD V9.1.

     

    take care.

    Mark

    markevans


  • 5.  Re: REST API from IBM i

    Posted Fri April 22, 2016 02:52 AM

    Hello Mark,

    thanks. Sounds good. I will start exploring.

    Tuukka

    TuukkaIlomäki


  • 6.  Re: REST API from IBM i

    Posted Wed April 20, 2016 11:40 AM

    HI Tuukka,

    Have you considered calling REST web services from DB2 for i using the HTTP UDFs and UDTFs?  You must be at v7.1 or higher.  Here's a link to the documentation: Accessing web services using IBM DB2 for i HTTP UDFs and UDTFs

    I've had success using it for calling internal SOAP services (EGL web generated) with some of our DB2 UDFs and stored procedures.

    Daron

    canutri


  • 7.  Re: REST API from IBM i

    Posted Thu April 21, 2016 02:32 AM

    Hello Daron,

    I did briefly consider HTTP UDFs and UDTFs but it sounded a little too complex a solution (a little like using carrier pigeons to send IP packets). I did some experiments with direct SQL queries but did not explore ways to integrate those into EGL code. Until now we have done minimally SQL development: no stored procedures, just a few occasional triggers.

    Tuukka

    TuukkaIlomäki